javascript - Videojs doesnt display the video -
im using latest version of videojs.
based on example http://jsfiddle.net/swinginsam/nwbug/#share
source code https://www.dropbox.com/s/me39t5mt34rewqw/video-js.rar
i dont know what's problem of this.
<!doctype html> <html> <head> <title>video.js | html5 video player</title> <!-- chang urls wherever video.js files hosted --> <link href="video-js.css" rel="stylesheet" type="text/css"> <!-- video.js must in <head> older ies work. --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script> <script src="video.js" type="text/javascript"></script> <!-- unless using cdn hosted version, update url flash swf --> <script> videojs.options.flash.swf = "video-js.swf"; </script> </head> <body> <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png" data-setup="{}"> <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' /> <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' /> <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' /> <track kind="captions" src="demo.captions.vtt" srclang="en" label="english"></track><!-- tracks need ending tag ie9 --> </video> <p> <span data-vid="01" class="playvid">1</span> <span data-vid="02" class="playvid">2</span> <span data-vid="03" class="playvid">3</span> </p> <script> var video = _v_("example_video_1", {}, function(){ // player (this) initialized , ready. }); $(".playvid").click(function(){ var videoname = $(this).attr("data-vid"); var video = _v_("example_video_1"); //video.src("http://dev.swinginsam.com/_files/testvid_"+ videoname +".mp4"); $("video:nth-child(1)").attr("src", "http://dev.swinginsam.com/_files/testvid_"+ videoname +".mp4"); $("video:nth-child(2)").attr("src", "http://dev.swinginsam.com/_files/testvid_"+ videoname +".webm"); $("video:nth-child(3)").attr("src", "http://dev.swinginsam.com/_files/testvid_"+ videoname +".ogv"); video.load(); video.play(); //video.src("http://video-js.zencoder.com/oceans-clip.mp4"); }); </script> </body> </html>
you might want put event video initialize.
eg:
var video = _v_("example_video_1", {}, function(){ $(".playvid").click(function(){ ... }); });
Comments
Post a Comment