Test page (not working properly on iPhone)
I have hundreds of videos on my site and I want to replace their opening. To avoid re-rendering all the videos again, I use the following code to add a new opening as a playlist item that will play before the original video, and then when the original video plays, the first 20 seconds (where the old hole is) will be cut.
<html> <head> <script src="/templates/it_365news/js/jwplayer/jwplayer.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script> <script> $(document).ready(function(){ $('#ready').html('document is ready at ' + new Date().getMinutes() + ":" + new Date().getSeconds() + ":" + new Date().getMilliseconds()) }) </script> </head> <body> <div id="vp0"> </div> <div id="ready" style="background:yellow"> </div> <div id="vr" style="background:red"> </div> <div id="vl" style="background:blue"> </div> <script> jwplayer.key = 'bwIDfauoN3m+MClNdkQb0YamUxTfzWw7ygugtA=='; jwplayer('vp0').setup({ "file": "http://video.jiuan.org/2017/May/luntan.mp4", "image": "http://www.jiuan.org/ffmpeg_image.php?file=2017/May/luntan.mp4&time=00:00:03&browser=true", "width": "100%", "aspectratio": "16:9" }) </script> <script> var jw = jwplayer('vp0'); var file = jw.getPlaylistItem('0').file; var image = "http://www.jiuan.org/ffmpeg_image.php?file=2017/May/UNG1.mp4&time=00:00:09&browser=true"; var title = jw.getPlaylistItem('0').title; var openning = {"file": "/videos/UNG.mp4","image": image,"title":title}; var video = {"file":file}; jw.setup({ "playlist":[openning,video], "visualplaylist": "false", "width": "100%", "aspectratio": "16:9" }) .on('playlistItem',function(){ $('#vr').html('video is ready at ' + new Date().getMinutes() + ":" + new Date().getSeconds() + ":" + new Date().getMilliseconds()); if (this.getPlaylistIndex() === 1){ $('#vl').html("cut"); this.seek(20); $('#vl').append('done'); } }); </script> </body> </html>
This works on Windows PC, Mac this.seek(20) and Android phones, but when it comes to the iPhone, a new discovery is added successfully, but the old discovery is still playing since this.seek(20) does not seem to work. Is there a better way to debug? And is there any other way to achieve my goal?
javascript iphone video jwplayer
shenkwen
source share