QT and Javascript Function

Using jQuery, I’m initially hiding an element on DOM ready and showing/
hiding it onclick. The element contains an mp3 audio file/controller
that auto-plays as soon as the element is shown:

$(document).ready(function() {
	$('#controller').hide();
	$('a#movie').click(function() {
		$('#controller').toggle();
		return false;
	});
});

Everything is peachy.

What I would like to happen is that when the mp3 is finished at 01:07
a js function would fire that hides the element again.

For kicks I embedded a standard href/url track into the mp3 that
simply reloaded the page. It works fine but there’s no sense in
reloading an entire page for one element.

Next I tried embedding the js to hide just the element:

$(document).ready(function() {
	$('#controller').hide();
	});

Here’s the final embedded track:

{QTtext}{font:Geneva}{plain}{size:12}{textColor: 65535, 65535, 65535} 
{backColor: 0, 0, 0}{justify:center}{timeScale:1000}{width:160}{height: 
48}{timeStamps:absolute}{language:0}{textEncoding:0}
[00:00:00.000]
{textBox: 0, 0, 50, 160}[00:01:070.00]
[00:00:58.000]
{textBox: 0, 0, 50, 160}A<$(document).ready(function() {
[00:00:58.000]
{textBox: 0, 0, 50, 160}	$('#controller').hide();
[00:00:58.000]
{textBox: 0, 0, 50, 160}	});> T<_self>
[00:01:07.000]

But instead of hiding the element it’s looking for a page.

I’m using this Apple tut <http://www.apple.com/quicktime/tutorials/hreftracks.html

Ideas?

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Todd,

You could try the “qt_timechanged” event fired from QuickTime:

http://developer.apple.com/safari/library/documentation/QuickTime/Conceptual/QTScripting_JavaScript/bQTScripting_JavaScri_Document/QuickTimeandJavaScri.html

I couldn’t get this to work on a regular video tag movie, I haven’t tried on an object/embed.

Also note the endtime parameter on object/embed, maybe this could be added dynamically when you want to shorten the movie?

Joe

On 8 May 2010, at 03:46, Todd wrote:

Using jQuery, I’m initially hiding an element on DOM ready and showing/hiding it onclick. The element contains an mp3 audio file/controller that auto-plays as soon as the element is shown:

$(document).ready(function() {
	$('#controller').hide();
	$('a#movie').click(function() {
		$('#controller').toggle();
		return false;
	});
});

Everything is peachy.

What I would like to happen is that when the mp3 is finished at 01:07 a js function would fire that hides the element again.

For kicks I embedded a standard href/url track into the mp3 that simply reloaded the page. It works fine but there’s no sense in reloading an entire page for one element.

Next I tried embedding the js to hide just the element:

$(document).ready(function() {
	$('#controller').hide();
	});

Here’s the final embedded track:

{QTtext}{font:Geneva}{plain}{size:12}{textColor: 65535, 65535, 65535}{backColor: 0, 0, 0}{justify:center}{timeScale:1000}{width:160}{height:48}{timeStamps:absolute}{language:0}{textEncoding:0}
[00:00:00.000]
{textBox: 0, 0, 50, 160}[00:01:070.00]
[00:00:58.000]
{textBox: 0, 0, 50, 160}A<$(document).ready(function() {
[00:00:58.000]
{textBox: 0, 0, 50, 160}	$('#controller').hide();
[00:00:58.000]
{textBox: 0, 0, 50, 160}	});> T<_self>
[00:01:07.000]

But instead of hiding the element it’s looking for a page.

I’m using this Apple tut http://www.apple.com/quicktime/tutorials/hreftracks.html

Ideas?

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Give this a look:

http://pastie.org/951498

It’s an extraction from a video editing site I’m building at the moment.

Every .8 seconds, it gets the current frame from the movie, and it does so while the movie is playing or while it is stopped. Note that the same loop is used to get the reference to the movie, because even if you put this script after the movie, you can’t count on the movie to “be there” in the global space when the script fires. So the script keeps checking to see if the movie is there until the reference exists.

You can use console.log to write out the exact frame that it gets at the point you want the movie to close. If you’re doing this, then change the frequency of the PeriodicalExecuter to something more humane, like 2 seconds.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options