// first load programm data and then player data // player data need programm data // do not change var stDummyMp4File='qtdemoprg.mp4'; // this dummy-file contains 2 seconds black video with silence // must exists // path only relative to html-dokument with Quicktime-player var arDataCollection=new Array(); var intDataCollectionIndex=-1; // must be -1 var arstDataCollection_Praefix=new Array(); var arstDataCollection_Suffix=new Array(); var arstDataCollection_Entry=new Array(); var arstDataCollection_Path=new Array(); var arstDataCollection_ParentID=new Array(); var arintDataCollection_WithMax=new Array(); var arintDataCollection_HeightMax=new Array(); var arstDataCollection_Media=new Array(); var arptParent=new Array(); var arptContainerDiv=new Array(); var arptEmbed=new Array(); var stContainerDIV_IDsuffix="RDIV"; var stEMBED_IDsuffix="EMB"; var stSELECT_IDsuffix="SEL"; var intNumberOfCreatedPlayer=0; // must be 0 // ----- duration to number ------------------------------------------------------ function fuDurationToString(X00) // X00 duration in milliseconds // reurns hh:mm:ss { var X01="00:00:00"; var X02=0; var X03=0; var X04=0; var X05=""; var X06=""; if(X00>0) { X02=X00/1000; X04=Math.floor(X02/3600); X02=X02-(X04*3600); if(X02>0) { X03=Math.floor(X02/60); X02=X02-(X03*60); } X05=X02.toString(); if(X05.length<1){X05="0"+X05;} if(X05.length<2){X05="0"+X05;} X06=X03.toString(); if(X06.length<1){X06="0"+X06;} if(X06.length<2){X06="0"+X06;} X01=X04.toString()+ ":"+X06+":"+X05; } return X01; } // ----- append duration --------------------------------------------------------- function fuAppendDuration(X00,X01,X02) // X00 string array // X01 int array of durations in millisekunden // X02 length of X00 and X01 // return X00 after append of duration string { var X03=0; if(X00!=null) {if(X01!=null) { if(X00.length==X02) {if(X01.length==X02) { for(X03=0;X030);} if(X00){X00=(navigator.appName.indexOf("Microsoft")!=-1);} return X00; // true for exist } // +++++ get reference function fuGetReference(X00) // X00 string, value of ID or NAME { var X01=null; if(X00!=null) {if(X00.length>0) { if(fuIEexist()) {X01=window[X00]; if(X01==null){X01=document.getElementById(X00);} if(X01==null){X01=document.getElementsByName(X00);} } else { X01=document[X00]; if(X01==null){X01=document.getElementById(X00);} if(X01==null){X01=document.getElementsByName(X00);} } } } return X01; } // ----- check plugin, only navigator.plugins, not active-X ---------------------- function fuPluginExist(X00) // X00 string, name of plugin f.e. "QuickTime" or "Shockwave" { var X01=false; var X02=0; var X03=0; var X04=""; X01=(X00!=null); if(X01){X01=(X00!="");} if(X01){X01=(navigator!=null);} if(X01){X01=(navigator.plugins!=null);} if(X01) { X02=navigator.plugins.length; X01=(X02>0); } if(X01) { X01=false; for(X03=0;X030){X01=X04.indexOf(X00)>=0;} } } } } return X01; // true for exist } // ----- check Quicktime-Plugin, only navigator.plugins, not active-X ------------ function fuQuicktimePluginExist() { var X00=false; var X01=""; var X02; var X03; // +++++ check document.body X00=(document.body!=null); if(X00) { // +++++ check Quicktime X00=fuPluginExist("QuickTime"); // +++++ create temporal object of Quicktime-player // if Microsoft Internet Explorer: not correct DOM possible (create not possible) if(X00) { X02=document.createElement('EMBED'); X00=(X02!=null); } if(X00) { X03=document.body.appendChild(X02); X00=(X03!=null); if(X00) { X03.style.visibility='hidden'; try { X03.width=intVideoWidthMaxStandard; X00=(X03.width==intVideoWidthMaxStandard); } catch(e){X00=false;} if(X00) { try { X03.height=intVideoHeightMaxStandard; X00=(X03.height==intVideoHeightMaxStandard); } catch(e){X00=false;} } if(X00) { try { X03.autoplay=false; X00=(X03.autoplay==false); } catch(e){X00=false;} } if(X00) { try { X03.src=stDummyMp4File; X00=(X03.src!=""); } catch(e){X00=false;} } X02=document.body.removeChild(X03); } } // +++++ if create not possible if(!X00) { // ----- first use ID X01=''; document.write(X01); X02=fuGetReference("ogg0qwebID"); X00=(X02!=null); // ----- then NAME if(!X00) { X01=''; document.write(X01); X02=fuGetReference("ogg0qwebID"); X00=(X02!=null); } // +++++ if player exist // some browser does not change HTML-DOM: removeChild not possible // if(X00){document.body.removeChild(X02);} } } return X00; } // ----- onclick-Handler SELECT -------------------------------------------------- function fuSelectOnClick(X00,X01,X02,X03) { var X04; var X05; var X06; var X07=0; var X08=false; var X09=""; var X10=""; // +++++ get container-DIV X04=fuGetReference(X00); if(X04!=null) { // +++++ get EMBED X05=fuGetReference(X01); if(X05!=null) { // +++++ get SELECT X06=fuGetReference(X02); if(X06!=null) { // +++++ get index of selected element X07=X06.selectedIndex; // +++++ if 0 do nothing // +++++ if 1 then stop if(X07==1) { try{X05.Stop();} catch (e1) { // X08=true; // user can stop with controls } } // +++++ if 2 then play if(X07==2) { try{X05.Play();} catch (e2) { // X08=true; // user can stop with controls } } // +++++ > 2 load media and start if(X07>2) { try { // ----- first .src X05.src=arstDataCollection_Media[X03][X07]; } catch (e3) { try { // ----- then .SetURL X05.SetURL(arstDataCollection_Media[X03][X07]); } catch (e4) { X08=true; // change media not possible with controls } } } } } // +++++ if errror erase player complete if(X08){X04.innerHTML="";} } } // ----- install all players, only EMBED, not active-X --------------------------- // document.body must exists (run function only inside of body) function fuInstallAllQuicktimePlayers() { var X00=false; var X01=0; var X02=0; var X03=0; var X04=0; var X05=""; var X06=""; var X07=""; var X08=""; var X09=-1; var X10=""; // +++++ check document.body prüfen X00=(document.body!=null); // +++++ check arDataCollection if(X00){X00=(arDataCollection!=null);} if(X00) { X01=arDataCollection.length; X00=(X01>0); } // +++++ FIRST read out arDataCollection if(X00) { X04=-1; for(X02=0;X020); } // +++++ check Quicktime, only navigator.plugins, not active-X if(X00){X00=fuQuicktimePluginExist();} if(X00) { for(X02=0;X02'; // +++++ SELECT X08+=('<' + 'SELECT ID="' + X07 + '"' + ' SIZE="1" TITLE="Apple Quicktime Player (mp4 (H264), mp3)"' + ' onclick="javascript:fuSelectOnClick(' + "'" + X05 + "','" + X06 + "','" + X07 + "'," + X02.toString() + ');">'); // +++++ init arstDataCollection_Media[X02]=new Array(); X09=-1; // index of arstDataCollection_Media[X02] // +++++ options "do nothing", stop und start X09++; // do nothing arstDataCollection_Media[X02][X09]=""; X08+=('<' + 'OPTION VALUE="' + X09.toString() + '" SELECTED> do nothing'); X09++; // stop arstDataCollection_Media[X02][X09]=""; X08+=('<' + 'OPTION VALUE="' + X09.toString() + '"> stop'); X09++; // start arstDataCollection_Media[X02][X09]=""; X08+=('<' + 'OPTION VALUE="' + X09.toString() + '"> play'); // +++++ create texts of entries of pullwown for(X03=0;X03' + arstDataCollection_Entry[X02][X03]); } } } } } } } } } } } X08+='<' + '/' + 'SELECT' + '>'; for(X03=0;X03<5;X03++){X08+=" ";} // 5 blanks // +++++ create Quicktime object with HTML X08+=('<' + 'EMBED ID="' + X06 + '"'); X08+=' TITLE="Apple Quicktime Player (mp4 (H264), mp3)"'; X08+=(' WIDTH="' + arintDataCollection_WithMax[X02].toString() + '"'); X08+=(' HEIGHT="' + arintDataCollection_HeightMax[X02].toString() + '"'); X08+=' CONTROLLER="true"'; X08+=' AUTOPLAY="true"'; // set .scr need autoplay set to true X08+=' PLUGINSPAGE="http://www.apple.com/quicktime/download/"'; X08+=' ENABLEJAVASCRIPT="true"'; // must be true X08+=' BGCOLOR="000000"'; X08+=' CACHE="true"'; // should be true // no MIME X08+=(' SRC="' + stDummyMp4File + '"'); // must be Dummy-file X08+=('>' + '<' + '/' + 'EMBED' + '>' + '<' + '/' + 'DIV' + '>'); // +++++ set .innerHTML arptParent[X02].innerHTML=X08; // +++++ check container-DIV arptContainerDiv[X02]=fuGetReference(X05); X00=(arptContainerDiv[X02]!=null); if(X00) { // ----- check EMBED arptEmbed[X02]=fuGetReference(X06); X00=(arptEmbed[X02]!=null); // ----- count created object if(X00){intNumberOfCreatedPlayer++;} else { // +++++ player not createable: erase player complete arptParent[X02].innerHTML=""; } } } } } } } } } // ----- no inits ---------------------------------------------------------------- // +++++ that's all ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++