<!DOCTYPE HTML><html><head><title>Media test: unseekable</title><scriptsrc="/tests/SimpleTest/SimpleTest.js"></script><linkrel="stylesheet"type="text/css"href="/tests/SimpleTest/test.css"/><scripttype="text/javascript"src="manifest.js"></script></head><body><preid="test"><scriptclass="testbody"type="text/javascript">/*Test that unseekable media can't be seeked. We load a media that shouldn'tbe seekable, and play through once. While playing through we repeatedly tryto seek and check that nothing happens when we do. We also verify that theseekable ranges are empty.*/varmanager=newMediaTestManager;varonseeking=function(event){varv=event.target;v.actuallySeeked=true;};varonseeked=function(event){varv=event.target;v.actuallySeeked=true;};varontimeupdate=function(event){varv=event.target;// Check that when we seek nothing happens.vart=v.currentTime;v.currentTime=v.currentTime/=2;ok(Math.abs(t-v.currentTime)<0.01,"Current time shouldn't change when seeking in unseekable media: "+v.name);// Check that the seekable ranges are empty.is(v.seekable.length,0,"Should have no seekable ranges in unseekable media: "+v.name);};varonended=function(event){varv=event.target;// Remove the event listeners so that they can't run if there are any pending// events.v.removeEventListener("seeking",onseeking);v.removeEventListener("seeked",onseeked);v.removeEventListener("timeupdate",ontimeupdate);v.removeEventListener("ended",onended);v.src="";if(v.parentNode){v.remove();}// Verify that none of the seeks we did in timeupdate actually seeked.ok(!v.actuallySeeked,"Should not be able to seek in unseekable media: "+v.name);manager.finished(v.token);}functionstartTest(test,token){varv=document.createElement('video');manager.started(token);v.name=test.name;v.src=test.name;v.token=token;v.autoplay="true";v.actuallySeeked=false;v.addEventListener("seeking",onseeking);v.addEventListener("seeked",onseeked);v.addEventListener("timeupdate",ontimeupdate);v.addEventListener("ended",onended);document.body.appendChild(v);}functioncanPlay(candidates){varv=document.createElement("video");varresources=candidates.filter(function(x){returnv.canPlayType(x.type);});return(resources.length);}if(canPlay(gUnseekableTests)){manager.runTests(gUnseekableTests,startTest);}else{todo(false,"No files of supported format to test");}</script></pre></body></html>