detail.html
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script type="text/javascript" charset="utf-8">
//详情页面JS
seajs.use(['js/channel/detail', 'js/public'], function(detail) {
if (detail) {
detail.init();
detail.videoMiniPlayer();
// IPAD上面的视频处理
if (navigator.userAgent.indexOf("iPad") !== -1) {
// 封面视频播放器替换为H5的VIDEO标签
if (!!$(".video-wrap").find("object").size()) {
$(".video-wrap").find("object").hide();
$("#video-ipad").show();
}
// 隐藏老格式的手机视频
if (!!$('.content-mobile-flash').size()) {
$('.content-mobile-flash').hide();
}
// 内容中视频播放器替换为H5的VIDEO标签
if (!!$(".text-body").find("object").size()) {
var defaultCover = $(".detail-body").attr("cover-url");
var playHref = "",
videoUrl = "",
videoCover = "",
videoHtml = "";
$(".text-body").find("object").each(function() {
playHref = $(this).find('embed').attr('src');
videoUrl = tools.request('url', playHref);
videoCover = tools.request('coverpic', playHref);
if (videoCover === "") {
videoCover = defaultCover;
}
videoCover = videoCover.replace(/%3A/g, ':').replace(/%2F/g, '/');
videoHtml = '<video controls="controls" preload="auto" width="700px" height="394px" poster="' + videoCover + '">' + '<source src="' + videoUrl + '" type="video/mp4">' + '</video>';
$(this).replaceWith(videoHtml);
});
}
}
}
});
</script>