这适用于JW Player 6.12的YouTube直播。请注意,YouTube网址需要实际广播才能实现:
<!DOCTYPE html> <html> <head> <title>Live YouTube</title> </head> <body> <script src="http://p.jwpcdn.com/6/12/jwplayer.js" type="text/javascript"></script> <div id="player"></div> <script type="text/javascript" language="javascript"> jwplayer("player").setup({ file: "//www.youtube.com/watch?v=U3dnUonOGOs", primary: 'flash' }); jwplayer().onPlay(function () { VideoLength = jwplayer().getDuration() * 1000; jwplayer().seek(jwplayer().getDuration()); jwplayer().getPosition() * 1000; }); jwplayer().onPause(function () { jwplayer().getPosition() * 1000; }); jwplayer().onBuffer(function () { jwplayer().getPosition() * 1000; }); jwplayer().onComplete(function () { jwplayer().getPosition() * 1000; }); </script> </body> </html>