// Google Chrome maybe supports .src="" but without effect: Playing music don't stop but .src have setted to empty string // In this case you MUST set .src to path and file of a dummy-media-file. // This case is not implemented here. You must do it by yourself. // Don't forget to replace all .src="". And dumy-file must have playable codec of media player // e.g. HTML-5-media video .webm or .ogg // audio .oga // Internet Explorer BGSOUND only audio .mp3 // Be shure that this Chroem-feature is implemented in other open browser. // Opera don't have this .src-problem of Google Chrome. // // JavaScript code exampe // // var X01=...; // this var of actual mediafile with path // var X02=...; // this var contains pointer of media player e.g. for HTML-5-media the pointer of created VIDEO-tag or AUDIO-tag // var X03=""; // // // ----- check stop // if(X01=="") // { // // get actual media // X03=X02.src; // // // ----- check media: only if NOT emtpy then stop possible // if(X03!="") // { // // ---- set dummyfile // X02.src= .... ; // filename witth path of dummyfile // } // } // // Create dummyfile by yourself with all taken codecs. // You should know which media you want to play. // // To set dummyfile with same codec of last played file you have to do: // // get suffix of last played file (see X01) // // get length of X01 // var X04=X01.length; // if(X04>1) // { // // get pos of last '.' // var X05=X01.lastIndexOf("."); // at pos 0 // // check suffix possible ('.' founded) // if(X05>=0) // { // X05++; // X04-=X05; // length minus pos, both at 1 // // number of chars after '.' // if(X04>0) // { // // get all chars after '.' // var X06=X00.substr(X05,X04); // // and convert to upper // X06=X06.toUpperCase(); // // now compare with suffixes of all media you want to play // if(X06=='WEBM') .... take dummyfile.webm // // and so on // } // } // } // // in case of suffix check dummy file // if founded suffix '.webm' then take dummyfile.webm // '.mp3' then take dummyfile.mp3 // ...... // if not founded suffix take empty string. // // put suffixes into array e.g. // // var arPossibleAndAllowedSuffixes=new Array // ('WEBM', .... ans so on .... ); // // At last this: // Be shure that entry of arstPL_LastPlayedMedia_SRC is NOT empty. // Empty string stops media in Opera Brwoser but not in Chrome. // To stop media use only dummyfile. // // Please check .setUrl-Bug of Chrome in use of Quicktime: // Path of media should campatible with clearing of bug. // Use example of code to clear the bug AND to get path of any mediafile. // Create function and use this function for Quicktime too, if you need. // // An other nice example of Google Chrome and Quickktime: setUrl-Bug. // // In HTML ist supported SRC and in script ist supported .setUrl(). // // Opera use SRC (in script .src) correctly and can use setUrl() too. // Using of .src is very often by handling of objects with SRC (like standard). // But Chrome ? Yeahh ... it takes only .setUrl() AND hase same effect like above: // Using of .src have no effect ! // // AND in use of setUrl() (Google Chrome) // autoplay must be active // relative path: media must be contained in same folder of this html document // OR in folder above of folder of this htmml document // 'media/' wrong // '../media' okay // full path possible too // // BUT in use of .scr (like Opera) // autoplay must be active // media can be contained where you want // 'media/' okay // '../media' okay // full path possible too // // Example for full path // // var stFullPathLocal="file:///X:/test/media'; // local // var stFullPath=''; // actual // if(window.location.hostname!=null){stFullPath=window.location.hostname;} // if browser online // // stFullPath contains your url of webpage e.g. 'www.test.com' (but without 'http://') // // Check this string if you want to be shure that webpage runs only from YOUR host, and e.g. not local at other computer. // if( (stFullPath!='') // IE, Chrome // && (stFullPath.indexOf('localhost',0)==-1) // Opera // ) // {stFullPath='http://'+stFullPath;} // if only then http-path for your http-server (e.g. apache) // else{stFullPath=stFullPathLocal;} // if not online use local path // stFullPath+='/'; // don't forget / at end // // // Opera and Chrome are not compatible.