Viewing File: /people/testlab/www/testlab.com.pl/player/player.html



 
        
      
            
            <script type="text/javascript"> 
            //<![CDATA[
                var myListener = new Object();
                
                /**
                 * Initialisation
                 */
                myListener.onInit = function()
                {
                    this.position = 0;
                };
                /**
                 * Update
                 */
                myListener.onUpdate = function()
                {
                    document.getElementById("info_playing").innerHTML = this.isPlaying;
                    document.getElementById("info_url").innerHTML = this.url;
                    document.getElementById("info_volume").innerHTML = this.volume;
                    document.getElementById("info_position").innerHTML = this.position;
                    document.getElementById("info_duration").innerHTML = this.duration;
                    document.getElementById("info_bytes").innerHTML = " (" + this.bytesPercent + "%)";//this.bytesLoaded + "/" + this.bytesTotal + 
                    
                    var isPlaying = (this.isPlaying == "true");
                    document.getElementById("playerplay").style.display = (isPlaying)?"none":"block";
                    document.getElementById("playerpause").style.display = (isPlaying)?"block":"none";
                    
                    var timelineWidth = 300;
                    var sliderWidth = 40;
                    var sliderPositionMin = 0;
                    var sliderPositionMax = sliderPositionMin + timelineWidth - sliderWidth;
                    var sliderPosition = sliderPositionMin + Math.round((timelineWidth - sliderWidth) * this.position / this.duration);
                    
                    if (sliderPosition < sliderPositionMin) {
                        sliderPosition = sliderPositionMin;
                    }
                    if (sliderPosition > sliderPositionMax) {
                        sliderPosition = sliderPositionMax;
                    }
                    
                    document.getElementById("playerslider").style.left = sliderPosition+"px";
                };
                
                function getFlashObject()
                {
                    return document.getElementById("myFlash");
                }
                function play()
                {
				setVolume();
				var track = document.getElementById("track").value;
                   
				   if (myListener.position == 0) {
                        getFlashObject().SetVariable("method:setUrl", track);
                    }
					
                    getFlashObject().SetVariable("method:play", "");
                    getFlashObject().SetVariable("enabled", "true");
                }
                function pause()
                {
                    getFlashObject().SetVariable("method:pause", "");
                }
                function stop()
                {
                    getFlashObject().SetVariable("method:stop", "");
                }
                function setPosition()
                {
                    var position = document.getElementById("inputPosition").value;
                    getFlashObject().SetVariable("method:setPosition", position);
                }
				function revPosition()
                {
                    var position = document.getElementById("info_position").innerHTML;
					position= Number(position)-10000;
				    getFlashObject().SetVariable("method:setPosition", position);
                }
				function ffwdPosition()
                {
                    var position = document.getElementById("info_position").innerHTML;
					position= Number(position)+10000;
					getFlashObject().SetVariable("method:setPosition", position);
                }
                function setVolume()
                {
                    var volume = document.getElementById("inputVolume").value;
                    getFlashObject().SetVariable("method:setVolume", volume);
                }
				function changeSlide()
				{
				stop();
				
				//wczytanie przez ajax nazwy pliku mp3
				if (document.getElementById("track").value=='klakson1.mp3') document.getElementById("track").value='silnik1.mp3';
				else document.getElementById("track").value='klakson1.mp3';
				
				
				}
            //]]>
            </script> 
            <!--[if IE]>
            <script type="text/javascript" event="FSCommand(command,args)" for="myFlash">
            eval(args);
            </script>
            <![endif]--> 
 <div>
            <object class="playerpreview" id="myFlash" type="application/x-shockwave-flash" data="player_mp3_js.swf" width="1" height="1"> 
                <param name="movie" value="player_mp3_js.swf" > 
                <param name="AllowScriptAccess" value="always" > 
                <param name="FlashVars" value="listener=myListener&amp;interval=500" > 
            </object> 
            <div id="player"> 
			    <div style='width:100%;height:0px;'>
                <div id="playerplay" class="button play"><a href="javascript:play()" title='Start'>PLAY</a></div> 
                <div id="playerpause" class="button pause"><a href="javascript:pause()" title='Pauza'>PAUSE</a></div> 
                <div id="playerstop" class="button stop"><a href="javascript:stop()" title='Stop'>STOP</a></div> 
				<div id="playerrev"  style='display:none' class="button rev"><a href="javascript:revPosition()" title='Cofnij o 10s'>REV</a></div> 
				<div id="playerffwd" class="button ffwd"  style='display:none'><a href="javascript:ffwdPosition()" title='Przyspiesz o 10s'>FFWD</a></div> 
				 <div style='height: 0px;float: left;padding:10px;font-size:13px;'>Wczytano : <span id="info_bytes">0%</span></div> 
               </div>
				<div id="timeline"><a id="playerslider" href="javascript:void(0);">SLIDER</a></div>
               <div style='background:url(images/volume_control.png) no-repeat left;height:40px'></div>
			
			</div> 
             
            <form action="/players/js/" method="post"> 
                <ul> 
                    <li>Change the volume: <input id="inputVolume" type="text" value="35" size="3"> <input type="button" value="Change" onclick="setVolume()"></li> 
					<li>Change track: <input id="track" type="text" value="silnik1.mp3" size="6">  <input type="button" value="Change" onclick="changeSlide()"></li> 
                </ul> 
            </form> 
            
			<ul  style='display:none'> 
                <li style='display:none;'>url : <span id="info_url">undefined</span></li> 
               
                <li style='display:none;'>isPlaying : <span id="info_playing">undefined</span></li> 
    
                <li style='display:none;'>position : <span id="info_position" >undefined</span></li> 
                <li style='display:none;'>duration : <span id="info_duration">undefined</span></li> 
                <li>volume : <span id="info_volume">undefined</span></li> 
            </ul> 
</div>

Back to Directory File Manager