Skip to content

Instantly share code, notes, and snippets.

@viko16
Created May 7, 2014 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viko16/55e8c69b81d96248f3ad to your computer and use it in GitHub Desktop.
Save viko16/55e8c69b81d96248f3ad to your computer and use it in GitHub Desktop.
替换新电影网播放器(临时
//插入播放器的css
var c = document.createElement('link');
c.setAttribute('href', 'http://172.16.144.62/video-js/video-js.css');
document.head.appendChild(c);
//插入播放器的js(为什么不用jquery的插入呢?因为jquery有防xss的限制...)
var j = document.createElement('script');
j.setAttribute('src', 'http://172.16.144.62/video-js/video.js');
document.head.appendChild(j);
//提取真实地址
var movieurl = $("object").find("param[name=FlashVars]").val().replace("&play_url=", "").split("&")[0];
//url编码解码
movieurl = unescape(movieurl);
//移除旧播放器,关闭一个不知道作用的轮询
$('object').remove();
clearInterval(nw_set_play_list_timer_id);
//插入播放器
var v = $("<video id='hehevideo' class='video-js vjs-default-skin' controls preload='none' width='960' height='540' data-setup='{}'></video>");
$('.live_player').append(v);
//然后就是插真实地址咯
var r = ("<source src='" + movieurl + "' type='video/mp4' />");
$('#hehevideo').append(r);
@viko16
Copy link
Author

viko16 commented May 8, 2014

有新版本了,做成了chrome插件
https://github.com/viko16/NavodHTML5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment