Showing
9 changed files
with
233 additions
and
233 deletions
@@ -4,26 +4,26 @@ | @@ -4,26 +4,26 @@ | ||
4 | * 直播或重播页面上方浮动的下载提示 | 4 | * 直播或重播页面上方浮动的下载提示 |
5 | * 用于跳转到对应的app页面或进入下载页面 | 5 | * 用于跳转到对应的app页面或进入下载页面 |
6 | */ | 6 | */ |
7 | -let is_wechat = false; //是否在微信中 | ||
8 | -let is_weibo = false; //是否在微博中 | ||
9 | - | ||
10 | -let is_ios = false; //是否是ios | ||
11 | -let is_android = false; //是否是android | ||
12 | -let is_pod = false; | ||
13 | -let is_pc = false; | ||
14 | -let $btn_download; //下载按钮 | ||
15 | -let $btn_close; //关闭按钮 | ||
16 | -let $download_head_wrapper; //下载div最外部分 | ||
17 | -let $download_head; //下载div fixed部分 | ||
18 | -let $download_msg; //在微信中点击下载弹出的提示部分 | ||
19 | - | ||
20 | -//let app_ios = 'mtmv://lives?id=6141903674538004481'; | ||
21 | -let app_ios = 'yohoefashion4In1://'; //ios的scheme | ||
22 | -let app_android = 'yohoefashion4In1://'; //android的scheme | ||
23 | -let download_ios = 'https://itunes.apple.com/cn/app/id530419467?ls=1&mt=8'; //appstore下载地址 | ||
24 | -let download_android = 'http://yoho-apps.qiniudn.com/Yoho.apk'; //apk下载地址 | ||
25 | -let queryArr = []; //地址栏参数 | ||
26 | -let date_start; //点击下载按钮的时间,用于计算超时的时候跳转到对应下载页面 | 7 | +var is_wechat = false; //是否在微信中 |
8 | +var is_weibo = false; //是否在微博中 | ||
9 | + | ||
10 | +var is_ios = false; //是否是ios | ||
11 | +var is_android = false; //是否是android | ||
12 | +var is_pod = false; | ||
13 | +var is_pc = false; | ||
14 | +var $btn_download; //下载按钮 | ||
15 | +var $btn_close; //关闭按钮 | ||
16 | +var $download_head_wrapper; //下载div最外部分 | ||
17 | +var $download_head; //下载div fixed部分 | ||
18 | +var $download_msg; //在微信中点击下载弹出的提示部分 | ||
19 | + | ||
20 | +//var app_ios = 'mtmv://lives?id=6141903674538004481'; | ||
21 | +var app_ios = 'yohoefashion4In1://'; //ios的scheme | ||
22 | +var app_android = 'yohoefashion4In1://'; //android的scheme | ||
23 | +var download_ios = 'https://itunes.apple.com/cn/app/id530419467?ls=1&mt=8'; //appstore下载地址 | ||
24 | +var download_android = 'http://yoho-apps.qiniudn.com/Yoho.apk'; //apk下载地址 | ||
25 | +var queryArr = []; //地址栏参数 | ||
26 | +var date_start; //点击下载按钮的时间,用于计算超时的时候跳转到对应下载页面 | ||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为 | 29 | * 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为 |
@@ -32,8 +32,8 @@ let date_start; //銝蝸嚗鈭恣蝞歲頧 | @@ -32,8 +32,8 @@ let date_start; //銝蝸嚗鈭恣蝞歲頧 | ||
32 | * @param link 对应的下载地址 | 32 | * @param link 对应的下载地址 |
33 | */ | 33 | */ |
34 | function openAppOrLink(app, link) { | 34 | function openAppOrLink(app, link) { |
35 | - let ifrSrc; | ||
36 | - let ifr; | 35 | + var ifrSrc; |
36 | + var ifr; | ||
37 | if (is_android) { | 37 | if (is_android) { |
38 | //安卓基本上打不开app,只能打开下载地址。。。 | 38 | //安卓基本上打不开app,只能打开下载地址。。。 |
39 | date_start = new Date(); | 39 | date_start = new Date(); |
@@ -46,8 +46,8 @@ function openAppOrLink(app, link) { | @@ -46,8 +46,8 @@ function openAppOrLink(app, link) { | ||
46 | document.body.appendChild(ifr); | 46 | document.body.appendChild(ifr); |
47 | 47 | ||
48 | setTimeout(function() { | 48 | setTimeout(function() { |
49 | - let date_end = new Date(); | ||
50 | - /*let p = document.createElement('p'); | 49 | + var date_end = new Date(); |
50 | + /*var p = document.createElement('p'); | ||
51 | p.innerHTML = date_end - date_start | 51 | p.innerHTML = date_end - date_start |
52 | document.body.appendChild(p);*/ | 52 | document.body.appendChild(p);*/ |
53 | if (date_end.getTime() - date_start.getTime() < 1300) { | 53 | if (date_end.getTime() - date_start.getTime() < 1300) { |
@@ -69,7 +69,7 @@ function openAppOrLink(app, link) { | @@ -69,7 +69,7 @@ function openAppOrLink(app, link) { | ||
69 | if (!is_pod) { | 69 | if (!is_pod) { |
70 | document.location.href = app; | 70 | document.location.href = app; |
71 | setTimeout(function() { | 71 | setTimeout(function() { |
72 | - let date_end = new Date(); | 72 | + var date_end = new Date(); |
73 | if (!is_pod) { | 73 | if (!is_pod) { |
74 | if (date_end.getTime() - date_start.getTime() < 1200) { | 74 | if (date_end.getTime() - date_start.getTime() < 1200) { |
75 | document.location.href = link; | 75 | document.location.href = link; |
@@ -80,7 +80,7 @@ function openAppOrLink(app, link) { | @@ -80,7 +80,7 @@ function openAppOrLink(app, link) { | ||
80 | } else { | 80 | } else { |
81 | document.location.href = app; | 81 | document.location.href = app; |
82 | setTimeout(function() { | 82 | setTimeout(function() { |
83 | - let date_end = new Date(); | 83 | + var date_end = new Date(); |
84 | if (is_pod) { | 84 | if (is_pod) { |
85 | //$('.live-app-desc p').eq(0).text(date_end.getTime() - date_start.getTime()); | 85 | //$('.live-app-desc p').eq(0).text(date_end.getTime() - date_start.getTime()); |
86 | if (date_end.getTime() - date_start.getTime() < 2003) { | 86 | if (date_end.getTime() - date_start.getTime() < 2003) { |
@@ -103,8 +103,8 @@ function openAppOrLink(app, link) { | @@ -103,8 +103,8 @@ function openAppOrLink(app, link) { | ||
103 | document.body.appendChild(ifr); | 103 | document.body.appendChild(ifr); |
104 | 104 | ||
105 | setTimeout(function() { | 105 | setTimeout(function() { |
106 | - let date_end = new Date(); | ||
107 | - /*let p = document.createElement('p'); | 106 | + var date_end = new Date(); |
107 | + /*var p = document.createElement('p'); | ||
108 | p.innerHTML = date_end - date_start | 108 | p.innerHTML = date_end - date_start |
109 | document.body.appendChild(p);*/ | 109 | document.body.appendChild(p);*/ |
110 | //alert(date_end.getTime() - date_start.getTime()); | 110 | //alert(date_end.getTime() - date_start.getTime()); |
@@ -137,7 +137,7 @@ function get_download_link() { | @@ -137,7 +137,7 @@ function get_download_link() { | ||
137 | * @returns {boolean} | 137 | * @returns {boolean} |
138 | */ | 138 | */ |
139 | function check_supperUniversalLink() { | 139 | function check_supperUniversalLink() { |
140 | - let osversion = navigator.userAgent.match(/iPhone OS (\d*)/); | 140 | + var osversion = navigator.userAgent.match(/iPhone OS (\d*)/); |
141 | //console.log(osversion && osversion[1]); | 141 | //console.log(osversion && osversion[1]); |
142 | return osversion && osversion[1]; | 142 | return osversion && osversion[1]; |
143 | /*if (osversion && osversion[1] >= 9) { | 143 | /*if (osversion && osversion[1] >= 9) { |
@@ -166,10 +166,10 @@ function show_download_msg() { | @@ -166,10 +166,10 @@ function show_download_msg() { | ||
166 | * @constructor | 166 | * @constructor |
167 | */ | 167 | */ |
168 | function ManageQueryString() { | 168 | function ManageQueryString() { |
169 | - let loc = document.location.href; | ||
170 | - let variables = ''; | ||
171 | - let variableArr = []; | ||
172 | - let finalArr = []; | 169 | + var loc = document.location.href; |
170 | + var variables = ''; | ||
171 | + var variableArr = []; | ||
172 | + var finalArr = []; | ||
173 | 173 | ||
174 | if (loc.indexOf('?') > 0) { | 174 | if (loc.indexOf('?') > 0) { |
175 | variables = loc.split('?')[1]; | 175 | variables = loc.split('?')[1]; |
@@ -179,8 +179,8 @@ function ManageQueryString() { | @@ -179,8 +179,8 @@ function ManageQueryString() { | ||
179 | variableArr = variables.split('&'); | 179 | variableArr = variables.split('&'); |
180 | } | 180 | } |
181 | 181 | ||
182 | - for (let i = 0; i < variableArr.length; i++) { | ||
183 | - let obj = {}; | 182 | + for (var i = 0; i < variableArr.length; i++) { |
183 | + var obj = {}; | ||
184 | obj.name = variableArr[i].split('=')[0]; | 184 | obj.name = variableArr[i].split('=')[0]; |
185 | obj.value = variableArr[i].split('=')[1]; | 185 | obj.value = variableArr[i].split('=')[1]; |
186 | finalArr.push(obj); | 186 | finalArr.push(obj); |
@@ -197,8 +197,8 @@ function ManageQueryString() { | @@ -197,8 +197,8 @@ function ManageQueryString() { | ||
197 | */ | 197 | */ |
198 | function getQueryString(arr, name) { | 198 | function getQueryString(arr, name) { |
199 | if (arr.length > 0) { | 199 | if (arr.length > 0) { |
200 | - for (let i = 0; i < arr.length; i++) { | ||
201 | - let obj = arr[i]; | 200 | + for (var i = 0; i < arr.length; i++) { |
201 | + var obj = arr[i]; | ||
202 | if (obj.name == name) { | 202 | if (obj.name == name) { |
203 | return obj.value; | 203 | return obj.value; |
204 | } | 204 | } |
@@ -207,7 +207,7 @@ function getQueryString(arr, name) { | @@ -207,7 +207,7 @@ function getQueryString(arr, name) { | ||
207 | } | 207 | } |
208 | 208 | ||
209 | function check_sys_open() { | 209 | function check_sys_open() { |
210 | - let download_type = ''; | 210 | + var download_type = ''; |
211 | if (is_android) { | 211 | if (is_android) { |
212 | download_type = 'android'; | 212 | download_type = 'android'; |
213 | openAppOrLink(app_android, download_android); | 213 | openAppOrLink(app_android, download_android); |
@@ -227,11 +227,11 @@ function check_sys_open() { | @@ -227,11 +227,11 @@ function check_sys_open() { | ||
227 | $(document).ready(function() { | 227 | $(document).ready(function() { |
228 | 228 | ||
229 | 229 | ||
230 | - let location = document.location.href; | 230 | + var location = document.location.href; |
231 | queryArr = ManageQueryString(); | 231 | queryArr = ManageQueryString(); |
232 | - let is_redirect = getQueryString(queryArr, 'redirect'); //从微信跳转过来的链接自动跳转到对应app | 232 | + var is_redirect = getQueryString(queryArr, 'redirect'); //从微信跳转过来的链接自动跳转到对应app |
233 | 233 | ||
234 | - let agent = navigator.userAgent.toLowerCase(); | 234 | + var agent = navigator.userAgent.toLowerCase(); |
235 | 235 | ||
236 | //判断环境 | 236 | //判断环境 |
237 | if (agent.match(/android/i) == 'android') { | 237 | if (agent.match(/android/i) == 'android') { |
@@ -283,7 +283,7 @@ $(document).ready(function() { | @@ -283,7 +283,7 @@ $(document).ready(function() { | ||
283 | $download_msg = $('.live-app-download-msg'); //提示在浏览器中打开 | 283 | $download_msg = $('.live-app-download-msg'); //提示在浏览器中打开 |
284 | 284 | ||
285 | $btn_download.on('click', function() { //点击下载按钮 | 285 | $btn_download.on('click', function() { //点击下载按钮 |
286 | - let download_type = ''; | 286 | + var download_type = ''; |
287 | if (is_android) { | 287 | if (is_android) { |
288 | download_type = 'android'; | 288 | download_type = 'android'; |
289 | openAppOrLink(app_android, download_android); | 289 | openAppOrLink(app_android, download_android); |
@@ -9,19 +9,19 @@ global.msg_obj = [ | @@ -9,19 +9,19 @@ global.msg_obj = [ | ||
9 | '{"avatar": "http://img01.yohoboys.com/contentimg/2016/06/15/14/012b97d00097fd444bd8f830ed2e8fe54e.jpg", "cmd": 5, "msg": "别和小编太较真", "name": "YOHO_187****1007", "room": 19177}' | 9 | '{"avatar": "http://img01.yohoboys.com/contentimg/2016/06/15/14/012b97d00097fd444bd8f830ed2e8fe54e.jpg", "cmd": 5, "msg": "别和小编太较真", "name": "YOHO_187****1007", "room": 19177}' |
10 | ]; | 10 | ]; |
11 | 11 | ||
12 | -let replay_msg = []; | 12 | +var replay_msg = []; |
13 | 13 | ||
14 | (function() { | 14 | (function() { |
15 | - for (let i = 0; i < 300; i++) { | ||
16 | - let time = 5 + i * 2; | ||
17 | - let rand = Math.floor(Math.random() * 2); | ||
18 | - let msg = ''; | 15 | + for (var i = 0; i < 300; i++) { |
16 | + var time = 5 + i * 2; | ||
17 | + var rand = Math.floor(Math.random() * 2); | ||
18 | + var msg = ''; | ||
19 | if (rand === 1) { | 19 | if (rand === 1) { |
20 | msg = '{"createtime":' + time + ',"avatar":"","name":"\u8c2d\u660e\u4e54' + i + '","msg":"测试消息测试消息测试消息测试消息测试消息测试消息' + i + '","cmd":"5"}' | 20 | msg = '{"createtime":' + time + ',"avatar":"","name":"\u8c2d\u660e\u4e54' + i + '","msg":"测试消息测试消息测试消息测试消息测试消息测试消息' + i + '","cmd":"5"}' |
21 | } else { | 21 | } else { |
22 | msg = '{"createtime":' + time + ',"avatar":"http:\/\/avatar.jpg","name":"测试登录' + i + '","msg":"","cmd":"4"}'; | 22 | msg = '{"createtime":' + time + ',"avatar":"http:\/\/avatar.jpg","name":"测试登录' + i + '","msg":"","cmd":"4"}'; |
23 | } | 23 | } |
24 | - let j = JSON.parse(msg); | 24 | + var j = JSON.parse(msg); |
25 | replay_msg.push(j); | 25 | replay_msg.push(j); |
26 | } | 26 | } |
27 | })(); | 27 | })(); |
1 | // 初始化config信息 | 1 | // 初始化config信息 |
2 | -let _weChatInterface = '//m.yohobuy.com/activity/wechat/share';// 签名等相关配置,yoho公众号 | 2 | +var _weChatInterface = '//m.yohobuy.com/activity/wechat/share';// 签名等相关配置,yoho公众号 |
3 | 3 | ||
4 | $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) { | 4 | $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) { |
5 | if (json && json !== '') { | 5 | if (json && json !== '') { |
6 | - let _appId = json.appId.toString(); | ||
7 | - let _timestamp = json.timestamp; | ||
8 | - let _nonceStr = json.nonceStr.toString(); | ||
9 | - let _signature = json.signature.toString(); | 6 | + var _appId = json.appId.toString(); |
7 | + var _timestamp = json.timestamp; | ||
8 | + var _nonceStr = json.nonceStr.toString(); | ||
9 | + var _signature = json.signature.toString(); | ||
10 | 10 | ||
11 | window.wx.config({ | 11 | window.wx.config({ |
12 | debug: true, | 12 | debug: true, |
@@ -59,11 +59,11 @@ $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('# | @@ -59,11 +59,11 @@ $.getJSON(_weChatInterface + '?url=' + encodeURIComponent(location.href.split('# | ||
59 | function share() { | 59 | function share() { |
60 | window.wx.ready(function() { | 60 | window.wx.ready(function() { |
61 | // 构造分享信息 | 61 | // 构造分享信息 |
62 | - let shareTitle = $('#shareTitle').val(); | ||
63 | - let shareImg = $('#shareImg').val(); | ||
64 | - let shareDesc = $('#shareDesc').val(); | ||
65 | - let shareLink = $('#shareLink').val(); | ||
66 | - let shareData = { | 62 | + var shareTitle = $('#shareTitle').val(); |
63 | + var shareImg = $('#shareImg').val(); | ||
64 | + var shareDesc = $('#shareDesc').val(); | ||
65 | + var shareLink = $('#shareLink').val(); | ||
66 | + var shareData = { | ||
67 | title: shareTitle, | 67 | title: shareTitle, |
68 | desc: shareDesc, | 68 | desc: shareDesc, |
69 | imgUrl: shareImg, | 69 | imgUrl: shareImg, |
@@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
3 | * 用于处理一些统计数据 | 3 | * 用于处理一些统计数据 |
4 | */ | 4 | */ |
5 | 5 | ||
6 | -let live_data_type = [ | 6 | +var live_data_type = [ |
7 | 'M_LIVE_DOWNLOAD_APP_TOP', | 7 | 'M_LIVE_DOWNLOAD_APP_TOP', |
8 | 'M_LIVE_DOWNLOAD_APP_CENTER', | 8 | 'M_LIVE_DOWNLOAD_APP_CENTER', |
9 | 'M_LIVE_PLAYBUTTON_CLICK', | 9 | 'M_LIVE_PLAYBUTTON_CLICK', |
10 | 'M_LIVE_SHARE']; | 10 | 'M_LIVE_SHARE']; |
11 | -let play_count = 0; | 11 | +var play_count = 0; |
12 | 12 | ||
13 | function send_data(obj) { | 13 | function send_data(obj) { |
14 | console.log(obj); | 14 | console.log(obj); |
@@ -18,21 +18,21 @@ function send_data(obj) { | @@ -18,21 +18,21 @@ function send_data(obj) { | ||
18 | } | 18 | } |
19 | 19 | ||
20 | function get_live_data() { | 20 | function get_live_data() { |
21 | - let data_prefix = 'YOHOBOYS'; | 21 | + var data_prefix = 'YOHOBOYS'; |
22 | 22 | ||
23 | if (document.location.hostname.indexOf('boy') > 0) { | 23 | if (document.location.hostname.indexOf('boy') > 0) { |
24 | data_prefix = 'YOHOBOYS'; | 24 | data_prefix = 'YOHOBOYS'; |
25 | } else if (document.location.hostname.indexOf('girl') > 0) { | 25 | } else if (document.location.hostname.indexOf('girl') > 0) { |
26 | data_prefix = 'YOHOGIRLS'; | 26 | data_prefix = 'YOHOGIRLS'; |
27 | } | 27 | } |
28 | - let data_type = (typeof(arguments[0]) === 'undefined') ? 0 : arguments[0]; | ||
29 | - let data_value = (typeof(arguments[1]) === 'undefined') ? 0 : arguments[1]; | 28 | + var data_type = (typeof(arguments[0]) === 'undefined') ? 0 : arguments[0]; |
29 | + var data_value = (typeof(arguments[1]) === 'undefined') ? 0 : arguments[1]; | ||
30 | 30 | ||
31 | console.log(data_type, data_value); | 31 | console.log(data_type, data_value); |
32 | 32 | ||
33 | if (data_type != 0 && data_prefix != '') { | 33 | if (data_type != 0 && data_prefix != '') { |
34 | - let data_type_str = data_prefix + live_data_type[data_type - 1]; | ||
35 | - let obj = {}; | 34 | + var data_type_str = data_prefix + live_data_type[data_type - 1]; |
35 | + var obj = {}; | ||
36 | 36 | ||
37 | obj.type = data_type_str; | 37 | obj.type = data_type_str; |
38 | if (data_value != 0) { | 38 | if (data_value != 0) { |
@@ -13,44 +13,44 @@ | @@ -13,44 +13,44 @@ | ||
13 | * manage_replay_chat_msg ===> 通过requestAnimationFrame每帧调用用于判断是否可以展示重播消息和点赞 | 13 | * manage_replay_chat_msg ===> 通过requestAnimationFrame每帧调用用于判断是否可以展示重播消息和点赞 |
14 | * replay_barrage_callback_handler ===> 由video的各个事件中调取的callback方法 | 14 | * replay_barrage_callback_handler ===> 由video的各个事件中调取的callback方法 |
15 | */ | 15 | */ |
16 | -let prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀 | ||
17 | -let requestAnimationFrame = window.requestAnimationFrame; | ||
18 | -let cancelAnimationFrame = window.cancelAnimationFrame; | ||
19 | - | ||
20 | -let site_url = STATIC_RESOURCE_PATH; | ||
21 | -let $btn_play; | ||
22 | -let video_width = 375; | ||
23 | -let video_height = 667; | ||
24 | -let video_id = 'yoho_live'; //视频video标签id | ||
25 | -let is_live = true; //是否是直播,根据地址栏参数可以判断 | ||
26 | -let get_socket_server_url = '/activity/live/barrage'; //获取websocket服务器的接口 | ||
27 | -let get_replay_chat_url = '/activity/live/replay/barrage'; //获取重播弹幕 | ||
28 | -let query_arr = []; //地址栏参数数组 | ||
29 | -let link_type = 'webksocket'; //连接类型 | ||
30 | -let live_ws; //websocket | ||
31 | -let heart_beat_interval; //心跳计时器 | ||
32 | -let live_time_interval; //播放时间计时器 | ||
33 | -let live_duration = 0; //播放时间计数器 | ||
34 | -let now_like_nums = 0; //当前点赞数 | ||
35 | -let $live_like_pannel; //点赞div,用于存放小脸动画 | ||
36 | -let is_animate = false; //用于控制动画的频率 | ||
37 | - | ||
38 | -let replay_video; | ||
39 | -let replay_new_start_time = 1466591331; //根据play进度调整的当前时间,用于获取重播弹幕 | ||
40 | -let replay_chat_interval = 60; //重播弹幕获取的时间区间长度,接口默认是5分钟 | ||
41 | -let replay_chat_arr = []; //用于存储重播弹幕obj | ||
42 | -let replay_chat_frame_count = 0; //用于计算执行requstAnimationFrames的次数 | ||
43 | -let is_replay_chat_loading = false; //是否正在调取接口 | ||
44 | -let can_seek = true; // | ||
45 | -let replay_per_like = 0; //平均每秒增加的点赞数 | ||
46 | -let replay_per_request_like = 0; //平均每帧增加的点赞数(大概) | ||
47 | -let replay_video_duration = 0; //重播视频 | ||
48 | -let replay_now_like = 0; //当前重播的点赞数 | ||
49 | -let is_wating = false; | ||
50 | - | ||
51 | -let test_count = 99; | ||
52 | - | ||
53 | -let CMD = { | 16 | +var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀 |
17 | +var requestAnimationFrame = window.requestAnimationFrame; | ||
18 | +var cancelAnimationFrame = window.cancelAnimationFrame; | ||
19 | + | ||
20 | +var site_url = STATIC_RESOURCE_PATH; | ||
21 | +var $btn_play; | ||
22 | +var video_width = 375; | ||
23 | +var video_height = 667; | ||
24 | +var video_id = 'yoho_live'; //视频video标签id | ||
25 | +var is_live = true; //是否是直播,根据地址栏参数可以判断 | ||
26 | +var get_socket_server_url = '/activity/live/barrage'; //获取websocket服务器的接口 | ||
27 | +var get_replay_chat_url = '/activity/live/replay/barrage'; //获取重播弹幕 | ||
28 | +var query_arr = []; //地址栏参数数组 | ||
29 | +var link_type = 'webksocket'; //连接类型 | ||
30 | +var live_ws; //websocket | ||
31 | +var heart_beat_interval; //心跳计时器 | ||
32 | +var live_time_interval; //播放时间计时器 | ||
33 | +var live_duration = 0; //播放时间计数器 | ||
34 | +var now_like_nums = 0; //当前点赞数 | ||
35 | +var $live_like_pannel; //点赞div,用于存放小脸动画 | ||
36 | +var is_animate = false; //用于控制动画的频率 | ||
37 | + | ||
38 | +var replay_video; | ||
39 | +var replay_new_start_time = 1466591331; //根据play进度调整的当前时间,用于获取重播弹幕 | ||
40 | +var replay_chat_interval = 60; //重播弹幕获取的时间区间长度,接口默认是5分钟 | ||
41 | +var replay_chat_arr = []; //用于存储重播弹幕obj | ||
42 | +var replay_chat_frame_count = 0; //用于计算执行requstAnimationFrames的次数 | ||
43 | +var is_replay_chat_loading = false; //是否正在调取接口 | ||
44 | +var can_seek = true; // | ||
45 | +var replay_per_like = 0; //平均每秒增加的点赞数 | ||
46 | +var replay_per_request_like = 0; //平均每帧增加的点赞数(大概) | ||
47 | +var replay_video_duration = 0; //重播视频 | ||
48 | +var replay_now_like = 0; //当前重播的点赞数 | ||
49 | +var is_wating = false; | ||
50 | + | ||
51 | +var test_count = 99; | ||
52 | + | ||
53 | +var CMD = { | ||
54 | LOGIN: 1, //客户端发送登录消息 | 54 | LOGIN: 1, //客户端发送登录消息 |
55 | SEND_MESSAGE: 2, //客户端发送消息 | 55 | SEND_MESSAGE: 2, //客户端发送消息 |
56 | LOGOUT: 3, //客户端发送退出消息 | 56 | LOGOUT: 3, //客户端发送退出消息 |
@@ -66,11 +66,11 @@ let CMD = { | @@ -66,11 +66,11 @@ let CMD = { | ||
66 | }; | 66 | }; |
67 | 67 | ||
68 | function set_duration () { | 68 | function set_duration () { |
69 | - let video = $('.video_player').find('video')[0]; | ||
70 | - let duration; | ||
71 | - let durationH; | ||
72 | - let durationM; | ||
73 | - let durationS; | 69 | + var video = $('.video_player').find('video')[0]; |
70 | + var duration; | ||
71 | + var durationH; | ||
72 | + var durationM; | ||
73 | + var durationS; | ||
74 | 74 | ||
75 | if (video) { | 75 | if (video) { |
76 | video.addEventListener('loadedmetadata', function() { | 76 | video.addEventListener('loadedmetadata', function() { |
@@ -103,16 +103,16 @@ function set_duration () { | @@ -103,16 +103,16 @@ function set_duration () { | ||
103 | */ | 103 | */ |
104 | function init_play_button() { | 104 | function init_play_button() { |
105 | global.$btn_play = $btn_play = $('.live-video-play-button a'); | 105 | global.$btn_play = $btn_play = $('.live-video-play-button a'); |
106 | - let video_source = $('#video_container').attr('data-video'); | 106 | + var video_source = $('#video_container').attr('data-video'); |
107 | $btn_play.on('click', function() { | 107 | $btn_play.on('click', function() { |
108 | $('#live-watermark').removeClass('hide'); | 108 | $('#live-watermark').removeClass('hide'); |
109 | if (live_type === 1 || live_type === 3) { | 109 | if (live_type === 1 || live_type === 3) { |
110 | if ($('#' + video_id)[0] == undefined) { | 110 | if ($('#' + video_id)[0] == undefined) { |
111 | get_chat_info(); //获取弹幕信息 | 111 | get_chat_info(); //获取弹幕信息 |
112 | 112 | ||
113 | - let _is_ios = true; | ||
114 | - let _is_wechat = false; | ||
115 | - let agent = navigator.userAgent.toLowerCase(); | 113 | + var _is_ios = true; |
114 | + var _is_wechat = false; | ||
115 | + var agent = navigator.userAgent.toLowerCase(); | ||
116 | //判断环境 | 116 | //判断环境 |
117 | if (agent.match(/android/i) == 'android') { | 117 | if (agent.match(/android/i) == 'android') { |
118 | _is_ios = false; | 118 | _is_ios = false; |
@@ -130,20 +130,20 @@ function init_play_button() { | @@ -130,20 +130,20 @@ function init_play_button() { | ||
130 | $('.live-video-cover').hide(); //隐藏封面 | 130 | $('.live-video-cover').hide(); //隐藏封面 |
131 | $('.live-app-download-head-wrap').hide(); //隐藏头部 | 131 | $('.live-app-download-head-wrap').hide(); //隐藏头部 |
132 | 132 | ||
133 | - let temp_height = $(window).height(); | ||
134 | - let temp_width = $(document).width(); | 133 | + var temp_height = $(window).height(); |
134 | + var temp_width = $(document).width(); | ||
135 | if (temp_width > 540) { | 135 | if (temp_width > 540) { |
136 | temp_width = 540; | 136 | temp_width = 540; |
137 | } | 137 | } |
138 | - let scale = 17.1 / 20; | 138 | + var scale = 17.1 / 20; |
139 | // if (temp_height > 30.15 * scale * (temp_width / 320 * 20)) { | 139 | // if (temp_height > 30.15 * scale * (temp_width / 320 * 20)) { |
140 | // temp_height = 30.15 * scale + 'rem'; | 140 | // temp_height = 30.15 * scale + 'rem'; |
141 | // } else { | 141 | // } else { |
142 | // temp_height = temp_height + 'px' | 142 | // temp_height = temp_height + 'px' |
143 | // } | 143 | // } |
144 | 144 | ||
145 | - let v_width = temp_width + 'px'; | ||
146 | - let v_height = 32.575 * scale + 'rem'; | 145 | + var v_width = temp_width + 'px'; |
146 | + var v_height = 32.575 * scale + 'rem'; | ||
147 | $('.live-loading-container').show(); //显示loading | 147 | $('.live-loading-container').show(); //显示loading |
148 | init_video(video_source, _is_wechat, _is_ios, '100%', '100%'); | 148 | init_video(video_source, _is_wechat, _is_ios, '100%', '100%'); |
149 | 149 | ||
@@ -271,7 +271,7 @@ function get_chat_info() { | @@ -271,7 +271,7 @@ function get_chat_info() { | ||
271 | * @param type 参数类型:websocket,tcp,用于获取不同协议的服务器地址 | 271 | * @param type 参数类型:websocket,tcp,用于获取不同协议的服务器地址 |
272 | */ | 272 | */ |
273 | function get_websocket_server(type) { | 273 | function get_websocket_server(type) { |
274 | - let param = type; | 274 | + var param = type; |
275 | $.ajax({ | 275 | $.ajax({ |
276 | url: get_socket_server_url, | 276 | url: get_socket_server_url, |
277 | data: { | 277 | data: { |
@@ -282,11 +282,11 @@ function get_websocket_server(type) { | @@ -282,11 +282,11 @@ function get_websocket_server(type) { | ||
282 | success: function(data) { | 282 | success: function(data) { |
283 | console.log(data); | 283 | console.log(data); |
284 | if (data.code === 200) { | 284 | if (data.code === 200) { |
285 | - let arr = data.data[0].split(':'); | ||
286 | - let ip = arr[0]; | ||
287 | - let port = arr[1]; | ||
288 | - let protocol = 'ws' | ||
289 | - // let protocol = location.protocol === 'https:' ? 'wss' :'ws' | 285 | + var arr = data.data[0].split(':'); |
286 | + var ip = arr[0]; | ||
287 | + var port = arr[1]; | ||
288 | + var protocol = 'ws' | ||
289 | + // var protocol = location.protocol === 'https:' ? 'wss' :'ws' | ||
290 | 290 | ||
291 | if (is_live) { | 291 | if (is_live) { |
292 | 292 | ||
@@ -304,7 +304,7 @@ function get_websocket_server(type) { | @@ -304,7 +304,7 @@ function get_websocket_server(type) { | ||
304 | * @param port | 304 | * @param port |
305 | */ | 305 | */ |
306 | function link_to_websocket_server(ip, port) { | 306 | function link_to_websocket_server(ip, port) { |
307 | - let path = ip + ':' + port; | 307 | + var path = ip + ':' + port; |
308 | live_ws = new WebSocket(path); | 308 | live_ws = new WebSocket(path); |
309 | 309 | ||
310 | live_ws.onopen = function(event) { | 310 | live_ws.onopen = function(event) { |
@@ -328,7 +328,7 @@ function link_to_websocket_server(ip, port) { | @@ -328,7 +328,7 @@ function link_to_websocket_server(ip, port) { | ||
328 | 328 | ||
329 | live_ws.onmessage = function(event) { | 329 | live_ws.onmessage = function(event) { |
330 | if (event.data) { | 330 | if (event.data) { |
331 | - let msg_obj = JSON.parse(event.data); | 331 | + var msg_obj = JSON.parse(event.data); |
332 | console.log(msg_obj, msg_obj.cmd); | 332 | console.log(msg_obj, msg_obj.cmd); |
333 | switch (msg_obj.cmd) { | 333 | switch (msg_obj.cmd) { |
334 | case 4: | 334 | case 4: |
@@ -365,7 +365,7 @@ function get_replay_chat_barrage(start_time, duration) { | @@ -365,7 +365,7 @@ function get_replay_chat_barrage(start_time, duration) { | ||
365 | replay_new_start_time = start_time; | 365 | replay_new_start_time = start_time; |
366 | } | 366 | } |
367 | is_replay_chat_loading = true; | 367 | is_replay_chat_loading = true; |
368 | - let ajax = $.ajax({ | 368 | + var ajax = $.ajax({ |
369 | url: get_replay_chat_url, | 369 | url: get_replay_chat_url, |
370 | data: { | 370 | data: { |
371 | id: live_room, | 371 | id: live_room, |
@@ -403,7 +403,7 @@ function get_replay_chat_barrage(start_time, duration) { | @@ -403,7 +403,7 @@ function get_replay_chat_barrage(start_time, duration) { | ||
403 | }); | 403 | }); |
404 | 404 | ||
405 | //用于测试 | 405 | //用于测试 |
406 | - /* let test_arr = test_replay(start_time, duration); | 406 | + /* var test_arr = test_replay(start_time, duration); |
407 | test_arr.forEach(function (obj) { | 407 | test_arr.forEach(function (obj) { |
408 | replay_chat_arr.push(obj); | 408 | replay_chat_arr.push(obj); |
409 | }); | 409 | }); |
@@ -418,7 +418,7 @@ function get_replay_chat_barrage(start_time, duration) { | @@ -418,7 +418,7 @@ function get_replay_chat_barrage(start_time, duration) { | ||
418 | * 开始 | 418 | * 开始 |
419 | */ | 419 | */ |
420 | function set_replay_chat_frame() { | 420 | function set_replay_chat_frame() { |
421 | - let element = $('#live_chat_ul'); | 421 | + var element = $('#live_chat_ul'); |
422 | requestAnimationFrame(manage_replay_chat_msg); | 422 | requestAnimationFrame(manage_replay_chat_msg); |
423 | } | 423 | } |
424 | 424 | ||
@@ -430,7 +430,7 @@ function manage_replay_chat_msg() { | @@ -430,7 +430,7 @@ function manage_replay_chat_msg() { | ||
430 | 430 | ||
431 | if (replay_video != undefined) { | 431 | if (replay_video != undefined) { |
432 | if (!replay_video.paused && !is_wating) { | 432 | if (!replay_video.paused && !is_wating) { |
433 | - let time = parseInt(replay_video.currentTime); | 433 | + var time = parseInt(replay_video.currentTime); |
434 | if (!isNaN(replay_video.duration) && replay_video.duration != 0) { | 434 | if (!isNaN(replay_video.duration) && replay_video.duration != 0) { |
435 | if (replay_video_duration === 0) { | 435 | if (replay_video_duration === 0) { |
436 | replay_video_duration = replay_video.duration; | 436 | replay_video_duration = replay_video.duration; |
@@ -448,20 +448,20 @@ function manage_replay_chat_msg() { | @@ -448,20 +448,20 @@ function manage_replay_chat_msg() { | ||
448 | 448 | ||
449 | if (replay_now_like - now_like_nums >= 1) { | 449 | if (replay_now_like - now_like_nums >= 1) { |
450 | now_like_nums = parseInt(replay_now_like); | 450 | now_like_nums = parseInt(replay_now_like); |
451 | - let msg = '{"cmd":9,"msg":' + now_like_nums + ',"room":' + live_room + ',"uid":1}'; | ||
452 | - let msg_obj = JSON.parse(msg); | 451 | + var msg = '{"cmd":9,"msg":' + now_like_nums + ',"room":' + live_room + ',"uid":1}'; |
452 | + var msg_obj = JSON.parse(msg); | ||
453 | insert_like(msg_obj); | 453 | insert_like(msg_obj); |
454 | } | 454 | } |
455 | } else if (replay_video.currentTime < 10) { | 455 | } else if (replay_video.currentTime < 10) { |
456 | - let msg = '{"cmd":9,"msg":0,"room":' + live_room + ',"uid":1}'; | ||
457 | - let msg_obj = JSON.parse(msg); | 456 | + var msg = '{"cmd":9,"msg":0,"room":' + live_room + ',"uid":1}'; |
457 | + var msg_obj = JSON.parse(msg); | ||
458 | insert_like(msg_obj); | 458 | insert_like(msg_obj); |
459 | } | 459 | } |
460 | 460 | ||
461 | } | 461 | } |
462 | 462 | ||
463 | if (replay_chat_arr.length > 0) { | 463 | if (replay_chat_arr.length > 0) { |
464 | - let obj = replay_chat_arr[0]; | 464 | + var obj = replay_chat_arr[0]; |
465 | if (obj.create_time <= time) { | 465 | if (obj.create_time <= time) { |
466 | if (obj.cmd == 5) { | 466 | if (obj.cmd == 5) { |
467 | insert_msg(obj) | 467 | insert_msg(obj) |
@@ -542,7 +542,7 @@ function replay_barrage_callback_handler(time, v_type) { | @@ -542,7 +542,7 @@ function replay_barrage_callback_handler(time, v_type) { | ||
542 | * @returns {string} | 542 | * @returns {string} |
543 | */ | 543 | */ |
544 | function get_cmd(cmd) { | 544 | function get_cmd(cmd) { |
545 | - let result = ''; | 545 | + var result = ''; |
546 | switch (cmd) { | 546 | switch (cmd) { |
547 | case 1: | 547 | case 1: |
548 | result = '{"cmd":' + cmd + ',"uid":"","name":"","avatar":"","room":' + live_room + '}'; | 548 | result = '{"cmd":' + cmd + ',"uid":"","name":"","avatar":"","room":' + live_room + '}'; |
@@ -570,10 +570,10 @@ function send_heart_beat() { | @@ -570,10 +570,10 @@ function send_heart_beat() { | ||
570 | */ | 570 | */ |
571 | 571 | ||
572 | function insert_msg(obj) { | 572 | function insert_msg(obj) { |
573 | - let $ul = $('#live_chat_ul'); | ||
574 | - let msg_html | 573 | + var $ul = $('#live_chat_ul'); |
574 | + var msg_html | ||
575 | if (obj.avatar == '' || obj.avatar == undefined) { | 575 | if (obj.avatar == '' || obj.avatar == undefined) { |
576 | - let rand = Math.floor(Math.random() * 5) + 1; | 576 | + var rand = Math.floor(Math.random() * 5) + 1; |
577 | // obj.avatar = site_url + '/img/activity/live/live/head_' + rand + '.png'; | 577 | // obj.avatar = site_url + '/img/activity/live/live/head_' + rand + '.png'; |
578 | 578 | ||
579 | msg_html = '<div class="live-item2"><div class="live-item2-head">' + | 579 | msg_html = '<div class="live-item2"><div class="live-item2-head">' + |
@@ -606,7 +606,7 @@ function insert_msg(obj) { | @@ -606,7 +606,7 @@ function insert_msg(obj) { | ||
606 | '</div>' + | 606 | '</div>' + |
607 | '</div>'; | 607 | '</div>'; |
608 | } | 608 | } |
609 | - let li = document.createElement('li'); | 609 | + var li = document.createElement('li'); |
610 | li.innerHTML = msg_html; | 610 | li.innerHTML = msg_html; |
611 | if ($ul.children().length >= 4) { | 611 | if ($ul.children().length >= 4) { |
612 | $ul.find('li').eq(0).remove(); | 612 | $ul.find('li').eq(0).remove(); |
@@ -620,9 +620,9 @@ function insert_msg(obj) { | @@ -620,9 +620,9 @@ function insert_msg(obj) { | ||
620 | */ | 620 | */ |
621 | function insert_user(obj) { | 621 | function insert_user(obj) { |
622 | if (obj.name.length > 1) { | 622 | if (obj.name.length > 1) { |
623 | - let $ul = $('#live_chat_ul'); | ||
624 | - let msg_html = '<div class="live-item1">' + '@' + obj.name + ' <span>已加入</span>' + '</div>'; | ||
625 | - let li = document.createElement('li'); | 623 | + var $ul = $('#live_chat_ul'); |
624 | + var msg_html = '<div class="live-item1">' + '@' + obj.name + ' <span>已加入</span>' + '</div>'; | ||
625 | + var li = document.createElement('li'); | ||
626 | li.innerHTML = msg_html; | 626 | li.innerHTML = msg_html; |
627 | if ($ul.children().length >= 4) { | 627 | if ($ul.children().length >= 4) { |
628 | $ul.find('li').eq(0).remove(); | 628 | $ul.find('li').eq(0).remove(); |
@@ -638,7 +638,7 @@ function insert_user(obj) { | @@ -638,7 +638,7 @@ function insert_user(obj) { | ||
638 | * @param obj | 638 | * @param obj |
639 | */ | 639 | */ |
640 | function insert_like(obj) { | 640 | function insert_like(obj) { |
641 | - let num = obj.msg.toString(); | 641 | + var num = obj.msg.toString(); |
642 | 642 | ||
643 | if (num.indexOf('万') < 0) { | 643 | if (num.indexOf('万') < 0) { |
644 | num = parseInt(num); | 644 | num = parseInt(num); |
@@ -651,15 +651,15 @@ function insert_like(obj) { | @@ -651,15 +651,15 @@ function insert_like(obj) { | ||
651 | } else { | 651 | } else { |
652 | if (!is_animate) { | 652 | if (!is_animate) { |
653 | is_animate = true; | 653 | is_animate = true; |
654 | - let like_rand = Math.floor(Math.random() * 3) + 1; | ||
655 | - let img_rand = Math.floor(Math.random() * 5) + 1; | ||
656 | - let img_path = site_url + '/img/activity/live/live/like_icon' + img_rand + '.png'; | ||
657 | - let id = 'js_keyframes_' + Math.random(); | ||
658 | - let like_class = 'like-icon' + ' scroll_animate_' + like_rand; | ||
659 | - let msg_html = '<img src="' + img_path + '">'; | 654 | + var like_rand = Math.floor(Math.random() * 3) + 1; |
655 | + var img_rand = Math.floor(Math.random() * 5) + 1; | ||
656 | + var img_path = site_url + '/img/activity/live/live/like_icon' + img_rand + '.png'; | ||
657 | + var id = 'js_keyframes_' + Math.random(); | ||
658 | + var like_class = 'like-icon' + ' scroll_animate_' + like_rand; | ||
659 | + var msg_html = '<img src="' + img_path + '">'; | ||
660 | 660 | ||
661 | 661 | ||
662 | - let anim_div = document.createElement('div'); | 662 | + var anim_div = document.createElement('div'); |
663 | anim_div.id = id; | 663 | anim_div.id = id; |
664 | anim_div.className = like_class; | 664 | anim_div.className = like_class; |
665 | anim_div.innerHTML = msg_html; | 665 | anim_div.innerHTML = msg_html; |
@@ -695,9 +695,9 @@ function insert_audience(obj) { | @@ -695,9 +695,9 @@ function insert_audience(obj) { | ||
695 | * @param obj | 695 | * @param obj |
696 | */ | 696 | */ |
697 | function insert_end(obj) { | 697 | function insert_end(obj) { |
698 | - let user_num = obj.audienceNums.toString(); | ||
699 | - let like_num = obj.likeNums.toString(); | ||
700 | - let video_len = obj.videoLen.toString(); | 698 | + var user_num = obj.audienceNums.toString(); |
699 | + var like_num = obj.likeNums.toString(); | ||
700 | + var video_len = obj.videoLen.toString(); | ||
701 | 701 | ||
702 | if (user_num.indexOf('万') < 0) { | 702 | if (user_num.indexOf('万') < 0) { |
703 | user_num = parseInt(user_num); | 703 | user_num = parseInt(user_num); |
@@ -715,7 +715,7 @@ function insert_end(obj) { | @@ -715,7 +715,7 @@ function insert_end(obj) { | ||
715 | like_num = (like_num / 10000).toFixed(1) + '万'; | 715 | like_num = (like_num / 10000).toFixed(1) + '万'; |
716 | } | 716 | } |
717 | 717 | ||
718 | - let video = $('#' + video_id)[0]; | 718 | + var video = $('#' + video_id)[0]; |
719 | if (video) { | 719 | if (video) { |
720 | setTimeout(function() { | 720 | setTimeout(function() { |
721 | video.pause(); | 721 | video.pause(); |
@@ -724,7 +724,7 @@ function insert_end(obj) { | @@ -724,7 +724,7 @@ function insert_end(obj) { | ||
724 | } | 724 | } |
725 | live_ws.close(); | 725 | live_ws.close(); |
726 | clearInterval(live_time_interval); | 726 | clearInterval(live_time_interval); |
727 | - let $liveEnd = $('#live-state-end'); | 727 | + var $liveEnd = $('#live-state-end'); |
728 | $liveEnd.show(); | 728 | $liveEnd.show(); |
729 | $liveEnd.find('.audience .val').text(user_num); | 729 | $liveEnd.find('.audience .val').text(user_num); |
730 | $liveEnd.find('.duration .val').text(video_len); | 730 | $liveEnd.find('.duration .val').text(video_len); |
@@ -751,7 +751,7 @@ function receive_init(obj) { | @@ -751,7 +751,7 @@ function receive_init(obj) { | ||
751 | */ | 751 | */ |
752 | function get_live_time() { | 752 | function get_live_time() { |
753 | if (live_start_time) { | 753 | if (live_start_time) { |
754 | - let date = new Date(); | 754 | + var date = new Date(); |
755 | live_duration = parseInt(date.getTime() / 1000) - live_start_time; | 755 | live_duration = parseInt(date.getTime() / 1000) - live_start_time; |
756 | console.log('live_duration=' + live_duration); | 756 | console.log('live_duration=' + live_duration); |
757 | $('#live_time').text(get_time_text(live_duration)); | 757 | $('#live_time').text(get_time_text(live_duration)); |
@@ -765,10 +765,10 @@ function get_live_time() { | @@ -765,10 +765,10 @@ function get_live_time() { | ||
765 | * @returns {string} | 765 | * @returns {string} |
766 | */ | 766 | */ |
767 | function get_time_text(time) { | 767 | function get_time_text(time) { |
768 | - let time_text = '00:00:00'; | ||
769 | - let sec; | ||
770 | - let min; | ||
771 | - let hour; | 768 | + var time_text = '00:00:00'; |
769 | + var sec; | ||
770 | + var min; | ||
771 | + var hour; | ||
772 | if (time < 0) { | 772 | if (time < 0) { |
773 | time = 0; | 773 | time = 0; |
774 | } | 774 | } |
@@ -794,7 +794,7 @@ function get_time_text(time) { | @@ -794,7 +794,7 @@ function get_time_text(time) { | ||
794 | } else { | 794 | } else { |
795 | hour = hour + ':'; | 795 | hour = hour + ':'; |
796 | } | 796 | } |
797 | - let rests = time % 3600; | 797 | + var rests = time % 3600; |
798 | min = (rests - rests % 60) / 60; | 798 | min = (rests - rests % 60) / 60; |
799 | if (min < 10) { | 799 | if (min < 10) { |
800 | min = '0' + min; | 800 | min = '0' + min; |
@@ -826,10 +826,10 @@ function set_interval_time() { | @@ -826,10 +826,10 @@ function set_interval_time() { | ||
826 | * requestAnimationFrame | 826 | * requestAnimationFrame |
827 | */ | 827 | */ |
828 | function init_request_animation_frames() { | 828 | function init_request_animation_frames() { |
829 | - let lastTime = 0; | ||
830 | - let prefix; | 829 | + var lastTime = 0; |
830 | + var prefix; | ||
831 | //通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式 | 831 | //通过遍历各浏览器前缀,来得到requestAnimationFrame和cancelAnimationFrame在当前浏览器的实现形式 |
832 | - for (let i = 0; i < prefixes.length; i++) { | 832 | + for (var i = 0; i < prefixes.length; i++) { |
833 | if (requestAnimationFrame && cancelAnimationFrame) { | 833 | if (requestAnimationFrame && cancelAnimationFrame) { |
834 | break; | 834 | break; |
835 | } | 835 | } |
@@ -841,10 +841,10 @@ function init_request_animation_frames() { | @@ -841,10 +841,10 @@ function init_request_animation_frames() { | ||
841 | //如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout | 841 | //如果当前浏览器不支持requestAnimationFrame和cancelAnimationFrame,则会退到setTimeout |
842 | if (!requestAnimationFrame || !cancelAnimationFrame) { | 842 | if (!requestAnimationFrame || !cancelAnimationFrame) { |
843 | requestAnimationFrame = function(callback) { | 843 | requestAnimationFrame = function(callback) { |
844 | - let currTime = new Date().getTime(); | 844 | + var currTime = new Date().getTime(); |
845 | //为了使setTimteout的尽可能的接近每秒60帧的效果 | 845 | //为了使setTimteout的尽可能的接近每秒60帧的效果 |
846 | - let timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
847 | - let id = window.setTimeout(function() { | 846 | + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); |
847 | + var id = window.setTimeout(function() { | ||
848 | callback(currTime + timeToCall); | 848 | callback(currTime + timeToCall); |
849 | }, timeToCall); | 849 | }, timeToCall); |
850 | lastTime = currTime + timeToCall; | 850 | lastTime = currTime + timeToCall; |
@@ -893,8 +893,8 @@ $(document).ready(function() { | @@ -893,8 +893,8 @@ $(document).ready(function() { | ||
893 | }); | 893 | }); |
894 | 894 | ||
895 | global.test = function test() { //测试弹幕样式 | 895 | global.test = function test() { //测试弹幕样式 |
896 | - let rand = Math.floor(Math.random() * msg_obj.length); | ||
897 | - let obj = JSON.parse(msg_obj[rand].toString()); | 896 | + var rand = Math.floor(Math.random() * msg_obj.length); |
897 | + var obj = JSON.parse(msg_obj[rand].toString()); | ||
898 | switch (obj.cmd) { | 898 | switch (obj.cmd) { |
899 | case 4: | 899 | case 4: |
900 | insert_user(obj); | 900 | insert_user(obj); |
@@ -906,21 +906,21 @@ global.test = function test() { //测试弹幕样式 | @@ -906,21 +906,21 @@ global.test = function test() { //测试弹幕样式 | ||
906 | } | 906 | } |
907 | 907 | ||
908 | global.test_like = function test_like() { | 908 | global.test_like = function test_like() { |
909 | - let rand = Math.floor(Math.random() * 5); | 909 | + var rand = Math.floor(Math.random() * 5); |
910 | test_count += rand; | 910 | test_count += rand; |
911 | - let obj_text = '{"cmd":9,"msg":' + test_count + ',"room":' + live_room + ',"uid":0}'; | ||
912 | - let obj = JSON.parse(obj_text); | 911 | + var obj_text = '{"cmd":9,"msg":' + test_count + ',"room":' + live_room + ',"uid":0}'; |
912 | + var obj = JSON.parse(obj_text); | ||
913 | insert_like(obj); | 913 | insert_like(obj); |
914 | } | 914 | } |
915 | 915 | ||
916 | global.test_replay = function test_replay(starttime, timeinterval) { | 916 | global.test_replay = function test_replay(starttime, timeinterval) { |
917 | - let start = starttime - live_start_time; | ||
918 | - let end = start + timeinterval; | ||
919 | - let test_arr = []; | 917 | + var start = starttime - live_start_time; |
918 | + var end = start + timeinterval; | ||
919 | + var test_arr = []; | ||
920 | if (replay_msg.length > 0) { | 920 | if (replay_msg.length > 0) { |
921 | - for (let i = 0; i < replay_msg.length; i++) { | ||
922 | - let obj = replay_msg[i]; | ||
923 | - let create_time = parseInt(obj.createtime); | 921 | + for (var i = 0; i < replay_msg.length; i++) { |
922 | + var obj = replay_msg[i]; | ||
923 | + var create_time = parseInt(obj.createtime); | ||
924 | if (create_time >= start && create_time <= end) { | 924 | if (create_time >= start && create_time <= end) { |
925 | test_arr.push(obj); | 925 | test_arr.push(obj); |
926 | } | 926 | } |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * Created by qiujun on 16/6/5. | 2 | * Created by qiujun on 16/6/5. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | -let info_text = '<p>今晚《奔跑吧兄弟》继续开跑,这期从预告片来看,怎么都觉得有点恐怖啊!</p>' + | 5 | +var info_text = '<p>今晚《奔跑吧兄弟》继续开跑,这期从预告片来看,怎么都觉得有点恐怖啊!</p>' + |
6 | '<div style="margin-top:10px;"></div>' + | 6 | '<div style="margin-top:10px;"></div>' + |
7 | '<img width="640px" h="640px" "style="margin:0 auto;border:0;display:block;" class="lazy" src="http://img02.yohoboys.com/contentimg/2016/06/10/21/02c6f92a8d88dbe1373f9f6215ea021348.jpg" data-original="http://img02.yohoboys.com/contentimg/2016/06/10/21/02c6f92a8d88dbe1373f9f6215ea021348.jpg" style="display: block;">' + | 7 | '<img width="640px" h="640px" "style="margin:0 auto;border:0;display:block;" class="lazy" src="http://img02.yohoboys.com/contentimg/2016/06/10/21/02c6f92a8d88dbe1373f9f6215ea021348.jpg" data-original="http://img02.yohoboys.com/contentimg/2016/06/10/21/02c6f92a8d88dbe1373f9f6215ea021348.jpg" style="display: block;">' + |
8 | '<span style="color:#B2AAA4;">▲游戏设施长这样!</span>' + | 8 | '<span style="color:#B2AAA4;">▲游戏设施长这样!</span>' + |
@@ -6,15 +6,15 @@ | @@ -6,15 +6,15 @@ | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
9 | - let share_sina_url = 'http://service.weibo.com/share/share.php?appkey=3910025296'; | ||
10 | - let share_qzon_url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey'; | ||
11 | - let share_facebook_url = 'https://www.facebook.com/sharer/sharer.php'; | ||
12 | - let share_twitter_url = 'http://twitter.com/intent/tweet'; | ||
13 | - let true_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01bec2ddcbb55247b2ac4869b3e4255286.png'; | ||
14 | - let fake_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01db287fedae82aa7f0155727b0b5a0936.png'; | ||
15 | - let true_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02.png'; | ||
16 | - let fake_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02-no.png'; | ||
17 | - let touch_timeout; | 9 | + var share_sina_url = 'http://service.weibo.com/share/share.php?appkey=3910025296'; |
10 | + var share_qzon_url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey'; | ||
11 | + var share_facebook_url = 'https://www.facebook.com/sharer/sharer.php'; | ||
12 | + var share_twitter_url = 'http://twitter.com/intent/tweet'; | ||
13 | + var true_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01bec2ddcbb55247b2ac4869b3e4255286.png'; | ||
14 | + var fake_yoho_img = '//img03.res.yoho.cn/blogimg/2016/06/21/18/01db287fedae82aa7f0155727b0b5a0936.png'; | ||
15 | + var true_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02.png'; | ||
16 | + var fake_yohogirl_img = '//cdn.yoho.cn/yohocn/160315/images/ewm-yoho02-no.png'; | ||
17 | + var touch_timeout; | ||
18 | 18 | ||
19 | $(document).ready(function() { | 19 | $(document).ready(function() { |
20 | // init_share_button(); | 20 | // init_share_button(); |
@@ -28,16 +28,16 @@ | @@ -28,16 +28,16 @@ | ||
28 | * 分享按钮 | 28 | * 分享按钮 |
29 | */ | 29 | */ |
30 | function init_share_button() { | 30 | function init_share_button() { |
31 | - let $btn_share_sina = $('.live-share-button-sina a'); | ||
32 | - let $btn_share_qzone = $('.live-share-button-qzone a'); | ||
33 | - let $btn_share_facebook = $('.live-share-button-facebook a'); | ||
34 | - let $btn_share_twitter = $('.live-share-button-twitter a'); | ||
35 | - let local_url = document.location.href; | ||
36 | - let protocol = document.location.protocol; | ||
37 | - let share_url = ''; | ||
38 | - let share_img = $('#share').attr('cover'); | ||
39 | - let share_title_sina = document.title + ' @YOHO潮流志 @YOHOGIRL '; | ||
40 | - let share_title_qzone = document.title + ' | 来自YOHO!'; | 31 | + var $btn_share_sina = $('.live-share-button-sina a'); |
32 | + var $btn_share_qzone = $('.live-share-button-qzone a'); | ||
33 | + var $btn_share_facebook = $('.live-share-button-facebook a'); | ||
34 | + var $btn_share_twitter = $('.live-share-button-twitter a'); | ||
35 | + var local_url = document.location.href; | ||
36 | + var protocol = document.location.protocol; | ||
37 | + var share_url = ''; | ||
38 | + var share_img = $('#share').attr('cover'); | ||
39 | + var share_title_sina = document.title + ' @YOHO潮流志 @YOHOGIRL '; | ||
40 | + var share_title_qzone = document.title + ' | 来自YOHO!'; | ||
41 | 41 | ||
42 | if (share_img.indexOf('http') < 0 && share_img.indexOf('https') < 0) { | 42 | if (share_img.indexOf('http') < 0 && share_img.indexOf('https') < 0) { |
43 | share_img = protocol + share_img; | 43 | share_img = protocol + share_img; |
@@ -77,8 +77,8 @@ | @@ -77,8 +77,8 @@ | ||
77 | * 由于微信不能同时识别两个二维码,所以按一个二维码的同时把另外一个二维码给换成点击的二维码的图片 | 77 | * 由于微信不能同时识别两个二维码,所以按一个二维码的同时把另外一个二维码给换成点击的二维码的图片 |
78 | */ | 78 | */ |
79 | function check_qr_touch() { | 79 | function check_qr_touch() { |
80 | - let $clz_img = $('#qr_clz img'); | ||
81 | - let $girl_img = $('#qr_girl img'); | 80 | + var $clz_img = $('#qr_clz img'); |
81 | + var $girl_img = $('#qr_girl img'); | ||
82 | 82 | ||
83 | $clz_img.on('touchstart', function() { | 83 | $clz_img.on('touchstart', function() { |
84 | $clz_img.attr('src', true_yoho_img); | 84 | $clz_img.attr('src', true_yoho_img); |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Created by qiujun on 16/05/24 | 3 | * Created by qiujun on 16/05/24 |
4 | * 一个所谓的video插件(伪) | 4 | * 一个所谓的video插件(伪) |
5 | */ | 5 | */ |
6 | -let _defaults = { | 6 | +var _defaults = { |
7 | video_id: 'yoho_video', | 7 | video_id: 'yoho_video', |
8 | islive: false, //是否是直播 | 8 | islive: false, //是否是直播 |
9 | width: '100%', | 9 | width: '100%', |
@@ -19,8 +19,8 @@ let _defaults = { | @@ -19,8 +19,8 @@ let _defaults = { | ||
19 | is_ios: true | 19 | is_ios: true |
20 | }; | 20 | }; |
21 | 21 | ||
22 | -let that; //用于引用this | ||
23 | -let video_src; | 22 | +var that; //用于引用this |
23 | +var video_src; | ||
24 | 24 | ||
25 | function YohoVideo($ele, options) { //构造函数 | 25 | function YohoVideo($ele, options) { //构造函数 |
26 | this.$ele = $ele; | 26 | this.$ele = $ele; |
@@ -39,15 +39,15 @@ YohoVideo.prototype = { | @@ -39,15 +39,15 @@ YohoVideo.prototype = { | ||
39 | this.bindEvent(); //初始化视频各个事件 | 39 | this.bindEvent(); //初始化视频各个事件 |
40 | }, | 40 | }, |
41 | innserVideoHtml: function() { | 41 | innserVideoHtml: function() { |
42 | - let _options = this._options; | 42 | + var _options = this._options; |
43 | this._width = _options.width || '100%'; | 43 | this._width = _options.width || '100%'; |
44 | this._height = _options.height || '100%'; | 44 | this._height = _options.height || '100%'; |
45 | - let _preload = _options.preload || false; | ||
46 | - let _autoplay = _options.autoplay || false; | ||
47 | - let _controls = _options.controls || false; | ||
48 | - let _poster = _options.poster || false; | ||
49 | - let _loop = _options.loop || false; | ||
50 | - let _src = _options.src || ''; | 45 | + var _preload = _options.preload || false; |
46 | + var _autoplay = _options.autoplay || false; | ||
47 | + var _controls = _options.controls || false; | ||
48 | + var _poster = _options.poster || false; | ||
49 | + var _loop = _options.loop || false; | ||
50 | + var _src = _options.src || ''; | ||
51 | this._loading_div = _options.loading_div || '.live-video-loading'; | 51 | this._loading_div = _options.loading_div || '.live-video-loading'; |
52 | this._video_id = _options.video_id || 'yoho_video'; | 52 | this._video_id = _options.video_id || 'yoho_video'; |
53 | this._islive = _options.islive || false; | 53 | this._islive = _options.islive || false; |
@@ -55,13 +55,13 @@ YohoVideo.prototype = { | @@ -55,13 +55,13 @@ YohoVideo.prototype = { | ||
55 | this._is_ios = _options.is_ios || true; | 55 | this._is_ios = _options.is_ios || true; |
56 | 56 | ||
57 | //console.log(_width,_height,_preload,_autoplay,_controls,_poster,_loop,_src); | 57 | //console.log(_width,_height,_preload,_autoplay,_controls,_poster,_loop,_src); |
58 | - /*let video = document.createElement('video'); | 58 | + /*var video = document.createElement('video'); |
59 | video.id = this._video_id; | 59 | video.id = this._video_id; |
60 | video.setAttribute('webkit-playsinline',true);*/ | 60 | video.setAttribute('webkit-playsinline',true);*/ |
61 | video_src = _src; | 61 | video_src = _src; |
62 | - let _attributes = ''; | ||
63 | - let _styles = ''; | ||
64 | - let _source = ''; | 62 | + var _attributes = ''; |
63 | + var _styles = ''; | ||
64 | + var _source = ''; | ||
65 | if (this._height != undefined) { | 65 | if (this._height != undefined) { |
66 | _styles += ' height:' + this._height + ';'; | 66 | _styles += ' height:' + this._height + ';'; |
67 | //video.style.height = _height; | 67 | //video.style.height = _height; |
@@ -95,11 +95,11 @@ YohoVideo.prototype = { | @@ -95,11 +95,11 @@ YohoVideo.prototype = { | ||
95 | //video.src = _src; | 95 | //video.src = _src; |
96 | } | 96 | } |
97 | 97 | ||
98 | - let _source_html = ''; | 98 | + var _source_html = ''; |
99 | //console.log(this._islive); | 99 | //console.log(this._islive); |
100 | if (!this._islive || this._islive) { | 100 | if (!this._islive || this._islive) { |
101 | - let _len = _src.length - _src.lastIndexOf('.'); | ||
102 | - let _type = _src.substr(_src.lastIndexOf('.') + 1, _len); | 101 | + var _len = _src.length - _src.lastIndexOf('.'); |
102 | + var _type = _src.substr(_src.lastIndexOf('.') + 1, _len); | ||
103 | if (_type === 'm3u8') { | 103 | if (_type === 'm3u8') { |
104 | _type = 'application/x-mpegurl'; | 104 | _type = 'application/x-mpegurl'; |
105 | } else { | 105 | } else { |
@@ -107,22 +107,22 @@ YohoVideo.prototype = { | @@ -107,22 +107,22 @@ YohoVideo.prototype = { | ||
107 | } | 107 | } |
108 | _source_html = '<source src="' + _src + '" type="' + _type + '">'; | 108 | _source_html = '<source src="' + _src + '" type="' + _type + '">'; |
109 | 109 | ||
110 | - /*let source = document.createElement('source'); | 110 | + /*var source = document.createElement('source'); |
111 | source.src = _src; | 111 | source.src = _src; |
112 | source.type = _type; | 112 | source.type = _type; |
113 | video.appendChild(source);*/ | 113 | video.appendChild(source);*/ |
114 | } | 114 | } |
115 | 115 | ||
116 | - let _video_html = '<video id="' + this._video_id + '" webkit-playsinline="true"' + _attributes + ' style="' + _styles + 'background:rgb(0,0,0)" webkit-playsinline>' + | 116 | + var _video_html = '<video id="' + this._video_id + '" webkit-playsinline="true"' + _attributes + ' style="' + _styles + 'background:rgb(0,0,0)" webkit-playsinline>' + |
117 | _source_html + | 117 | _source_html + |
118 | '</video>'; | 118 | '</video>'; |
119 | //console.log(_video_html); | 119 | //console.log(_video_html); |
120 | this.$ele.html(_video_html); | 120 | this.$ele.html(_video_html); |
121 | - let video = $('#' + this._video_id)[0]; | 121 | + var video = $('#' + this._video_id)[0]; |
122 | video.allowFullScreen = false; | 122 | video.allowFullScreen = false; |
123 | if (this._islive || _type == 'application/x-mpegurl') { | 123 | if (this._islive || _type == 'application/x-mpegurl') { |
124 | if (video.hasChildNodes()) { | 124 | if (video.hasChildNodes()) { |
125 | - let source_node = video.childNodes[0]; | 125 | + var source_node = video.childNodes[0]; |
126 | video.removeChild(source_node); | 126 | video.removeChild(source_node); |
127 | video.src = _src; | 127 | video.src = _src; |
128 | video.play(); | 128 | video.play(); |
@@ -135,9 +135,9 @@ YohoVideo.prototype = { | @@ -135,9 +135,9 @@ YohoVideo.prototype = { | ||
135 | //this.$ele.append(video); | 135 | //this.$ele.append(video); |
136 | }, | 136 | }, |
137 | exitFull: function() { //退出全屏 | 137 | exitFull: function() { //退出全屏 |
138 | - let _video = $('#' + this._video_id)[0]; | 138 | + var _video = $('#' + this._video_id)[0]; |
139 | 139 | ||
140 | - //let _video = this._video; | 140 | + //var _video = this._video; |
141 | //alert(_video.exitFullscreen || _video.msExitFullscreen || _video.oRequestFullscreen || _video.webkitCancelFullScreen || _video.webkitExitFullscreen); | 141 | //alert(_video.exitFullscreen || _video.msExitFullscreen || _video.oRequestFullscreen || _video.webkitCancelFullScreen || _video.webkitExitFullscreen); |
142 | if (_video.exitFullScreen) { | 142 | if (_video.exitFullScreen) { |
143 | _video.exitFullScreen(); | 143 | _video.exitFullScreen(); |
@@ -152,27 +152,27 @@ YohoVideo.prototype = { | @@ -152,27 +152,27 @@ YohoVideo.prototype = { | ||
152 | } | 152 | } |
153 | }, | 153 | }, |
154 | bindEvent: function() { | 154 | bindEvent: function() { |
155 | - let _video = $('#' + this._video_id)[0]; | 155 | + var _video = $('#' + this._video_id)[0]; |
156 | _video.isFullscreen = false; | 156 | _video.isFullscreen = false; |
157 | _video.scrollLeft = 0; | 157 | _video.scrollLeft = 0; |
158 | _video.scrollTop = 0; | 158 | _video.scrollTop = 0; |
159 | //console.log(this._width,this._height); | 159 | //console.log(this._width,this._height); |
160 | - _video.scrollWidth = this._width; | ||
161 | - _video.scrollHeight = this._height; | 160 | + // _video.scrollWidth = this._width; |
161 | + // _video.scrollHeight = this._height; | ||
162 | 162 | ||
163 | - //let _video = this._video; | 163 | + //var _video = this._video; |
164 | console.log('video=', _video); | 164 | console.log('video=', _video); |
165 | - let _msg_pannel = $(this._loading_div); | ||
166 | - let _msg = _msg_pannel.find('p'); | ||
167 | - let _progress_count = 0; | 165 | + var _msg_pannel = $(this._loading_div); |
166 | + var _msg = _msg_pannel.find('p'); | ||
167 | + var _progress_count = 0; | ||
168 | 168 | ||
169 | - let _error_count = 0; | 169 | + var _error_count = 0; |
170 | 170 | ||
171 | //networkState:0.此元素未初始化 1.正常但没有使用网络 2.正在下载数据 3.没有找到资源 | 171 | //networkState:0.此元素未初始化 1.正常但没有使用网络 2.正在下载数据 3.没有找到资源 |
172 | //readyState: | 172 | //readyState: |
173 | // 1:HAVE_NOTHING 2:HAVE_METADATA 3.HAVE_CURRENT_DATA 4.HAVE_FUTURE_DATA 5.HAVE_ENOUGH_DATA | 173 | // 1:HAVE_NOTHING 2:HAVE_METADATA 3.HAVE_CURRENT_DATA 4.HAVE_FUTURE_DATA 5.HAVE_ENOUGH_DATA |
174 | 174 | ||
175 | - let media_events = { | 175 | + var media_events = { |
176 | LOAD_START: 'loadstart', | 176 | LOAD_START: 'loadstart', |
177 | PROGRESS: 'progress', | 177 | PROGRESS: 'progress', |
178 | SUSPEND: 'suspend', | 178 | SUSPEND: 'suspend', |
-
Please register or login to post a comment