The only time I use a prototype function in the <body> of the document is to create a function that plays a movie when a thumbnail is clicked.
The function is:
Code:
<script>
function setMovie( url, title )
{
$('movieHost').innerHTML = '';
var elEmbed = document.createElement( 'embed' );
elEmbed.src = url;
elEmbed.setAttribute("width", "100%");
elEmbed.setAttribute("height","100%");
elEmbed.setAttribute("scale","aspect");
elEmbed.setAttribute("bgcolor","black");
$('movieHost').appendChild( elEmbed );
$('nowPlaying').innerHTML = title;
}
new Ajax.Request( '', {
method: 'get',
onSuccess: function( transport ) {
var bFirst = true;
for( var b = 0; b < movieTags.length; b++ ) {
if ( bFirst )
{
setMovie( url, title );
bFirst = false;
}
var html = '<a href="javascript:void setMovie(\''+url+'\',\''+title+'\');">';
html += title+'</a><br/>';
}
}
} );
</script>
The only problem I'm having is that I call the function at body onload:
Code:
<BODY onload="setMovie('Quicktimes/mov1.mov', 'Suzuki : "Fence" 1 of 12')">
In order that the first movie starts playing right away...
And everything is fine... EXCEPT that about 10 or 15 seconds into the first movie it skips back to the beginning and starts playing again. Once it's done that everything works fine until a page reload - and then it plays and skips back.
I've tried changing the order of the script references in the <head> section... but that breaks the uize framework.
Is it possible there's some way to recode the function with absolutes?
The Uize framework handles a horizontal thumbnail scroller... I thought that there might be a conflict in the shorthand of the two frameworks that could be resolved by going back to 'longhand' of one of them, as it were.
The weird thing is that if I reference the prototype.js script before the uize.js script then the movie restart glitch goes away (but it breaks the scroller).
The only thing I can think of that is triggering 10-15s in is Quicktime plugin's 'fast start' ability means that a quicktime only starts playing (on download from a server anyway) once a certain percentage of the movie is cached on the users computer... maybe there's something there. But why does referencing the prototype.js script first fix it?!
Actually I've been playing with a slightly different approach - recommended by Apple:
But in order for this to work then the 'media/mov1.mov' would need to be a variable that could be called by an onclick event. I've been trying to figure out how to incorporate the url of the quicktime as a variable into the function... so far with little success ;p
But in order for this to work then the 'media/mov1.mov' would need to be a variable that could be called by an onclick event. I've been trying to figure out how to incorporate the url of the quicktime as a variable into the function... so far with little success ;p
Code:
<script language="JavaScript" type="text/javascript"><!--
function moviepicker(what){
if(what == ""){ what = 'media/mov1.mov';}
that way you can specifiy what movie. you could also call that function from your onload or wherever. if the "what" arg is blank, it defaults to your first movie.
you could also pass what movie with your url string via get or something i suppose if that's useful
it probably doesn't help that you have stuff commented out... you have the closing // --> twice, not sure if that'll screw stuff up
also, i don't know how much QT cares about the format it receives args in. it might be pissed off that url doesn't have single quotes around it for all i know. i wouldn't think so, but i don't know QT
throw some alerts in and see how car it's making it
but I can't get it to work... The QT_WriteOBJECT function references the AC_Quicktime.js external script (which is quoted in full at the end of this post).
Possibly buried in it is the answer to how to pass variables such as src url to the QT_WriteObject function, but my rudimentary scripting skills just aren't up to the task...
If there are any insights - they would be much appreciated... sorry about the homework! :P
function QT_WriteOBJECT() takes no arguments... but calls _QTGenerate that does. everything makes sense to me except how the arguments make it in there for the code generation.
But I scatter about looking for code snippets as well... I always test them in un-hacked state to verify that they perform as promised... then keep adjusting til I break them, then step backwards.
as a possible solution as an event at the thumbnail - but I can't get it to work either... v frustrating. Especially since everything else on the page is working perfectly - horizontal scrolling thumbnails, dynamic auto resizing of the browser centered movie as the viewport is user-resized, forward html php, and a js driven fullscreen option.
Umm... that works, of course, when the user actually clicks on a thumbnail to choose a particular movie.
But... the quicktimes are daisychained - either by calling the next in a string through the qtnext parameter or by an href call from the final frame of the movie.
That means if there are, say, five movies to choose from (and therefore five thumbnails), then if the user were to click NO thumbnails all five movies would play in order. The user could then jump forward to movie #3, say, and then #4 and #5 would play on automatically when #3 finished.
This, of course, means that there may not be an onclick event... yet the movie will still change...
.. and therefore the title should somehow also change.
can you add an arg to SetURL(new url)? like SetURL(new_url, new_title)?
if not, you need a place to drop an attribute in that would contain the title. then from within SetURL(new url) or one of those functions have it read that attribute and set the title
not seeing what you're working with now i really can't be any more specific i guess