authentication.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <style>
  2. .border-radius-top{border-radius: 4px 4px 0px 0px;}
  3. .border-radius-bottom{border-radius:0px 0px 4px 4px;}
  4. /*主播认证*/
  5. /*认证第一步*/
  6. .verificationOne{width: 1020px; word-wrap: break-word;}
  7. .verificationTitle{height: 56px; line-height: 56px; font-size: 20px; font-weight: 700; font-style: normal; color: #333333; text-align: center; background-color: #E4E4E4;}
  8. .verificationBody{font-weight: 400;font-style: normal;font-size: 13px;color: #333333;}
  9. .verificationNext{height: 34px; line-height: 34px; text-align: center; color: #FFFFFF; font-weight: 700; font-style: normal; background-image: url(<%=public_path%>/img/u507.png);}
  10. .verificationNextGray{height: 34px; line-height: 34px; text-align: center; color: #FFFFFF; font-weight: 700; font-style: normal; background-image: url(<%=public_path%>/img/u554.png);}
  11. .verificationBodyStepOne{margin: 10px auto; width: 981px; height: 32px; background-image: url(<%=public_path%>/img/u614.png);}
  12. .bold{font-weight: 700;font-size: 12px;}
  13. .verificationBodyStepOneText{width: 981px; margin: 0px auto 15px;}
  14. .verificationBodyStepOneTextSample{width: 888px; height: 150px; margin: 10px auto;}
  15. .verificationBodyStepOneTextArrow{margin-left: 12px; margin-bottom: 55px; margin-right: 12px;}
  16. .verificationBodyStepOneExample img{width: 149px; height: 100px; float: left;}
  17. .verificationBodyStepOneExample div{float: left; height: 100px; line-height: 100px; margin-left: 12px; margin-right: 12px;}
  18. /*认证第二步*/
  19. .verificationTwo{width: 1020px; word-wrap: break-word;}
  20. .verificationBodyStepTwo{margin: 10px auto; width: 981px; height: 32px; background-image: url(<%=public_path%>/img/u615.png);}
  21. .verificationBodyFilePiece{text-align: center; position:relative; width: 970px; height: 536px; margin: 5px auto; background-color: #F2F2F2;}
  22. .upFile{position: absolute; top:0px; left: 0px; width: 971px; height: 537px;}
  23. /*认证第三步*/
  24. .verificationThree{width: 1020px;}
  25. .verificationBodyStepThree{margin: 10px auto; width: 981px; height: 32px; background-image: url(<%=public_path%>/img/u616.png);}
  26. .selectImgPreviewBtn input{display: none;}
  27. .videoBtn{width: 44px; height: 44px; border-radius: 100%; background-color: #ffffff; position: absolute; bottom: 33px; left: 48%; z-index: 900;}
  28. .videoBtnB{width: 36px; height: 36px; border-radius: 100%; background-color: #000000; position: absolute; bottom: 4px; left: 4px; z-index: 901;}
  29. .videoBtnR{width: 30px; height: 30px; border-radius: 100%; background-color: #ff0000; position: absolute; bottom: 3px; left: 3px; z-index: 902;}
  30. .videoBtnNum{width: 26px; height: 26px; border-radius: 5px; background-color: #ff0000; position: absolute; bottom: 5px; left: 5px; z-index: 902; color: #ffffff; font-weight: 700; font-size: 16px; line-height: 26px; text-align: center;}
  31. .videoBtnText{position: absolute; color: #ffffff; bottom: 13px; left: 46%; z-index: 900;}
  32. .goback{position: absolute; border-radius: 4px; bottom: 200px; left: 430px; z-index: 900; width: 133px; height: 32px; line-height: 32px; text-align: center; font-weight: 700; background-color: #E0E0E0; color: #5E5E5E;}
  33. .video{width: 990px; height: 558px; margin: 0px auto 20px; position: relative;}
  34. .PlayVideo{position: absolute; top: 237px; left: 358px; width: 100px; height: 80px; text-align: center;}
  35. .deleteVideo{position: absolute; top: 237px; left: 538px; width: 100px; height: 80px; text-align: center;}
  36. .PreviewMasking{position: absolute;left: 0px;top: 0px;background-color: #000000; width: 100%; height: 100%;filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5;}
  37. /*认证第四步*/
  38. .verificationFour{width: 1020px;}
  39. .verificationBodyStepFour{margin: 10px auto; width: 981px; height: 32px; background-image: url(<%=public_path%>/img/u617.png);}
  40. .verificationFourPreview{width: 980px; margin: 20px auto;}
  41. .verificationFourPreviewLeft{float: left; width: 484px;}
  42. .verificationFourPreviewLeftDiv{height: 274px; margin-top: 5px; text-align: center; background-color: #E4E4E4;}
  43. .verificationFourPreviewLeftImg{max-height: 274px; max-width: 484px;}
  44. .PlayVideoFour{position: absolute; left: 195px; top:100px; width: 100px; height: 80px; text-align: center;}
  45. .selectImgDescription{text-align: center; margin-top: 53px;}
  46. .selectImgDescription a{color: #1E1E1E;}
  47. .underline{text-decoration:underline;}
  48. .PreviewMaskingFour{position: absolute;left: 0px;top: 0px;background-color: #000000; width: 100%; height: 100%;filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5;}
  49. /*认证完成*/
  50. .verificationFive{width: 1020px;}
  51. .verificationBodyStepFive{margin: 10px auto; width: 981px; height: 32px; background-image: url(<%=public_path%>/img/u618.png);}
  52. .complete{width: 165px; margin: 0px auto 10px;}
  53. .completeText{font-size: 16px;color: #949494; margin-bottom: 20px;}
  54. .completeHref{line-height: 20px;}
  55. .completeHref span{text-decoration:underline;color: #339900;font-weight: 400;font-size: 13px;}
  56. </style>
  57. <!--认证第一步-->
  58. <div class="verificationOne" >
  59. <div class="verificationTitle border-radius-top">
  60. Identity Verification
  61. </div>
  62. <div class="verificationBody">
  63. <div class="verificationBodyStepOne"></div>
  64. <div class="clear"></div>
  65. <div class="verificationBodyStepOneText">
  66. In order to ensure that your account is used only by you personally, we will need to conduct identity verification by collecting your identity document soft copy and a video verification the first time you sign into our site.
  67. </div>
  68. <div class="verificationBodyStepOneText">
  69. <span class="bold">1) Requirements of your identity document soft copy</span><br>
  70. <p style="text-indent: 14px;">The soft copy of your ID document must be clearly visible and identifiable.</p>
  71. </div>
  72. <div class="verificationBodyStepOneText">
  73. <span class="bold">2) Procedure of shooting your verification video</span><br>
  74. <div class="verificationBodyStepOneTextSample">
  75. <img src="<%=public_path%>/img/u823.png" style="width: 242px; height: 146px;">
  76. <img class="verificationBodyStepOneTextArrow" src="<%=public_path%>/img/u857.png">
  77. <img src="<%=public_path%>/img/u843.png" style="width: 242px; height: 146px;">
  78. <img class="verificationBodyStepOneTextArrow" src="<%=public_path%>/img/u857.png">
  79. <img src="<%=public_path%>/img/u847.png" style="width: 242px; height: 146px;">
  80. </div>
  81. <div style="width: 960px; margin: 0px auto;">
  82. <div style="float: left; width: 310px; text-align: center;">Your face must be clearly visible and identifiable at the first screen</div>
  83. <div style="float: left; width: 300px; margin-left: 8px; text-align: center;">Then hold your Application form for Broadcasting below your face. Your face and the form must be fully visible</div>
  84. <div style="float: left; width: 300px; margin-left: 12px; text-align: center;">Move the form close to the front of your webcam and make sure the content is clearly identifiable</div>
  85. </div>
  86. </div>
  87. <div class="clear"></div>
  88. <div style="margin-left: 20px; margin-top: 40px; margin-bottom: 10px;">Note: Please download the application form template here in <a href="<%=public_path%>/file/<%=pdfFile%>" target="_blank">pdf document</a> or <a href="<%=public_path%>/file/<%=wordFile%>" target="_blank">word document</a></div>
  89. </div>
  90. <div class="verificationNext One cursor border-radius-bottom" >
  91. <span>NEXT</span>
  92. </div>
  93. </div>
  94. <!--认证第二步-->
  95. <div class="verificationTwo" style="display: none;">
  96. <div class="verificationTitle border-radius-top">
  97. Identity Verification
  98. </div>
  99. <div class="verificationBody">
  100. <div class="verificationBodyStepTwo"></div>
  101. <div class="clear"></div>
  102. <div class="verificationBodyFilePiece">
  103. <div id="selectFile">
  104. <img id="showSelectFile" style="max-width: 971px; max-height: 537px;" src="<%=public_path%>/img/u536.png">
  105. <label class="cursor upFile">
  106. <input type="file" name="file" style="display: none;" accept="image/jpg,image/jpeg,image/png">
  107. </label>
  108. </div>
  109. </div>
  110. <div style="margin-top: 5px; margin-bottom: 5px; margin-left: 25px;">Note: Only JPG and PNG allowed. File size must be less than 3MB. Image size must be between 560 * 560 to 2400 * 2400 pixels.</div>
  111. </div>
  112. <div class="verificationNext Two cursor border-radius-bottom" >
  113. <span>NEXT</span>
  114. </div>
  115. </div>
  116. <!--认证第三步-->
  117. <div class="verificationThree" style="display: none;">
  118. <div class="verificationTitle border-radius-top">
  119. Identity Verification
  120. </div>
  121. <div class="verificationBody">
  122. <div class="verificationBodyStepThree"></div>
  123. <!--推流-->
  124. <div class="video record">
  125. <embed src="<%=public_path%>/js/jQuery-webcam-master/LivePayerVideoCertification.swf" wmode="opaque" quality="High" bgcolor="#000000" style="height:100%;width:100%;" id="publish" name="publish" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars="d=1&amp;sl=0&amp;w=640&amp;h=360&amp;ssb=1&amp;hp=main&amp;t=LIVE1001#uid#FPVOUW6Z_1512715135074&amp;bt=0&amp;btm=0&amp;pw=640&amp;ph=360&amp;ps=15&amp;pk=15&amp;ar=44&amp;pb=1000,800,600&amp;amp?">
  126. <img class="disconnect" style="display: none" src="<%=public_path%>/img/u620.png">
  127. <div class="goPreview" style="display: none">
  128. <div class="goback cursor">GO BACK</div>
  129. </div>
  130. <div class="startRecording" style="display: none;">
  131. <div class="videoBtn cursor"><div class="videoBtnB"><div class="videoBtnR"></div></div></div>
  132. <div class="videoBtnText">Start recording</div>
  133. </div>
  134. <div class="endRecording" style="display: none;">
  135. <div class="videoBtn cursor"><div class="videoBtnB"><div class="videoBtnNum">30</div></div></div>
  136. <div class="videoBtnText" style="left: 47.3%;">Recording</div>
  137. </div>
  138. </div>
  139. <!--生成视频-->
  140. <div class="video load" style="background-color: #000000; text-align: center; display: none;">
  141. <img style="margin-top: 130px;" src="<%=public_path%>/img/u648.gif">
  142. </div>
  143. <!--预览-->
  144. <div class="video Preview" style="display: none;">
  145. <video width="100%" height="100%" onended="showPlayVideo();" id="PreviewVideo"></video>
  146. <div class="PreviewMasking"></div>
  147. <div class="cursor PlayVideo">
  148. <img src="<%=public_path%>/img/u626.png" style="height: 58px; width: 71px;">
  149. <div style="color: #ffffff;">Preview Video</div>
  150. </div>
  151. <div class="cursor deleteVideo">
  152. <img src="<%=public_path%>/img/u650.png" style="height: 58px;">
  153. <div style="color: #ffffff;">Delete & Re-take</div>
  154. </div>
  155. </div>
  156. <!--找不到摄像头-->
  157. <div class="video noVideo" style="display: none;">
  158. <img src="<%=public_path%>/img/u619.png">
  159. </div>
  160. </div>
  161. <div class="verificationNextGray Three cursor border-radius-bottom" >
  162. <span>NEXT</span>
  163. </div>
  164. </div>
  165. <!--认证第四步-->
  166. <div class="verificationFour" style="display: none;">
  167. <div class="verificationTitle border-radius-top">
  168. Identity Verification
  169. </div>
  170. <div class="verificationBody">
  171. <div class="verificationBodyStepFour"></div>
  172. <div class="clear"></div>
  173. <div class="verificationFourPreview">
  174. <div class="verificationFourPreviewLeft">
  175. <p>Your identity document soft copy</p>
  176. <div class="verificationFourPreviewLeftDiv">
  177. <img class="verificationFourPreviewLeftImg">
  178. </div>
  179. </div>
  180. <div class="verificationFourPreviewLeft" style="margin-left: 10px;">
  181. <p>Your video verification</p>
  182. <div class="verificationFourPreviewLeftDiv" style="position: relative;">
  183. <video width="100%" height="100%" onended="showPlayVideoFour();" id="PreviewVideoFour"></video>
  184. <div class="PreviewMaskingFour"></div>
  185. <div class="cursor PlayVideoFour">
  186. <img src="<%=public_path%>/img/u626.png" style="height: 58px; width: 71px;">
  187. <div style="color: #ffffff;">Preview Video</div>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="clear"></div>
  192. <div class="selectImgDescription">
  193. By submitting your verification, you agree to the</br>
  194. <span class="underline"><a href="/broadcast/index?url=/broadcast/terms/termsOne" target="_blank">Terms of Use</a></span>, <span class="underline"><a href="/broadcast/index?url=/broadcast/terms/termsTwo" target="_blank">Service Fee Calculation</a></span> and <span class="underline"><a href="/broadcast/index?url=/broadcast/terms/termsThree" target="_blank">Broadcaster Code of Conduct</a></span>
  195. </div>
  196. </div>
  197. </div>
  198. <div class="verificationNext Four cursor border-radius-bottom" >
  199. <span>Submit</span>
  200. </div>
  201. </div>
  202. <!--认证完成-->
  203. <div class="verificationFive" style="display: none;">
  204. <div class="verificationTitle border-radius-top">
  205. Identity Verification
  206. </div>
  207. <div class="verificationBody">
  208. <div class="verificationBodyStepFive"></div>
  209. <div class="clear"></div>
  210. <div style="width: 980px; height: 420px; text-align: center;">
  211. <br><br><br><br><br>
  212. <div class="complete"><img src="<%=public_path%>/img/u523.png"></div>
  213. <div class="completeText">
  214. Your identity verification request has been submitted.</br>
  215. We will conduct the review as soon as possible.
  216. </div>
  217. <div style="font-weight: 700;color: #6B6B6B; margin-bottom: 15px;">Before your identity is verified, you can:</div>
  218. <div class="completeHref">
  219. <span id="coverHref" class="cursor">Upload broadcast cover</span></br>
  220. <span id="photosHref" class="cursor">Manage your album photos</span></br>
  221. <span id="talentsHref" class="cursor">Manage your talents</span></br>
  222. <span id="timetableHref" class="cursor">Setup your booking timetable</span></br>
  223. </div>
  224. </div>
  225. </div>
  226. <div class="verificationNext Five cursor border-radius-bottom" >
  227. <span>Done</span>
  228. </div>
  229. </div>
  230. <script>
  231. var layerIndex = parent.layer.getFrameIndex(window.name);
  232. parent.layer.iframeAuto(layerIndex);
  233. $('#coverHref').click(function(){
  234. Cookies.set('verificationStatus', {status:1});
  235. parent.layer.close(layerIndex);
  236. })
  237. $('#photosHref').click(function(){
  238. Cookies.set('verificationStatus', {status:2});
  239. parent.layer.close(layerIndex);
  240. })
  241. $('#talentsHref').click(function(){
  242. Cookies.set('verificationStatus', {status:3});
  243. parent.layer.close(layerIndex);
  244. })
  245. $('#timetableHref').click(function(){
  246. Cookies.set('verificationStatus', {status:4});
  247. parent.layer.close(layerIndex);
  248. })
  249. //选择图片
  250. var imgBlob = '';
  251. var objUrl = '';
  252. $(document).on('change', 'input[name="file"]', function(){
  253. if(this.files[0]){
  254. imgBlob = this.files[0];
  255. }else{
  256. imgBlob = imgBlob;
  257. }
  258. objUrl = getObjectURL(imgBlob);
  259. if(imgBlob.size > 3 * 1024 * 1024){
  260. myParentAlert('Only JPG and PNG allowed. File size must be less than 3MB. Image size must be between 560 * 560 to 2400 * 2400 pixels.');
  261. emptiedFile();
  262. imgBlob = '';
  263. return false;
  264. }
  265. var image = new Image();
  266. image.src = objUrl;
  267. image.onload = function(){
  268. var width = image.width;
  269. var height = image.height;
  270. if(width<560 || height<560){
  271. myParentAlert('Only JPG and PNG allowed. File size must be less than 3MB. Image size must be between 560 * 560 to 2400 * 2400 pixels.');
  272. emptiedFile();
  273. imgBlob = '';
  274. return false;
  275. }
  276. if(width>2400 || height>2400){
  277. myParentAlert('Only JPG and PNG allowed. File size must be less than 3MB. Image size must be between 560 * 560 to 2400 * 2400 pixels.');
  278. emptiedFile();
  279. imgBlob = '';
  280. return false;
  281. }
  282. $('#showSelectFile').attr('src',objUrl);
  283. }
  284. })
  285. //清空表单数据,解决重复选择同一张图片的问题。
  286. function emptiedFile(){
  287. $("input[name='file']").val('');
  288. }
  289. //认证第一步
  290. $('.One').click(function(){
  291. $('.verificationOne').hide();
  292. $('.verificationTwo').show();
  293. //自适应高度
  294. parent.layer.iframeAuto(layerIndex);
  295. })
  296. //认证第二步
  297. $('.Two').click(function(){
  298. if(!imgBlob){
  299. return false;
  300. }
  301. $('.verificationTwo').hide();
  302. $('.verificationThree').show();
  303. //自适应高度
  304. parent.layer.iframeAuto(layerIndex);
  305. })
  306. //认证第三步
  307. $('.Three').click(function(){
  308. if(!record_url){
  309. return false;
  310. }
  311. $('.verificationThree').hide();
  312. $('.verificationFour').show();
  313. $('.verificationFourPreviewLeftImg').attr('src',objUrl);
  314. $('#PreviewVideoFour').attr('src',record_url);
  315. //自适应高度
  316. parent.layer.iframeAuto(layerIndex);
  317. })
  318. //认证第四步
  319. var subThree = 0;
  320. $('.Four').click(function(){
  321. if(!imgBlob || !record_url || subThree){
  322. return false;
  323. }
  324. subThree = 1;
  325. var loadVideo = layer.load(2);
  326. var formData = new FormData();
  327. formData.append("file",imgBlob);
  328. $.ajax('<%=server_host%>/api/?act=uploadIdcard',
  329. {
  330. method: "POST",
  331. dataType: "json",
  332. timeout: 120000,
  333. data: formData,
  334. processData: false,
  335. contentType: false,
  336. success: function (data) {
  337. if(data.errno == 0){
  338. var img = data.data.url;
  339. $.post('/broadcast/authenticationLayer/authenticationAjax', {img:img,record_url:record_url}, function(data){
  340. if(data.errno == 0){
  341. $('.verificationFour').hide();
  342. $('.verificationFive').show();
  343. }else{
  344. myParentAlert(data.errno + ':' + data.errmsg);
  345. }
  346. subThree = 0;
  347. layer.close(loadVideo);
  348. //自适应高度
  349. parent.layer.iframeAuto(layerIndex);
  350. })
  351. }else{
  352. myParentAlert('Failed to submit your request. Please try again.' + data.errno);
  353. subThree = 0;
  354. layer.close(loadVideo);
  355. }
  356. },
  357. error: function (XMLHttpRequest, status, errorThrown) {
  358. if(status == 'timeout'){
  359. myParentAlert('Image upload timeout.');
  360. }else{
  361. myParentAlert(status);
  362. }
  363. subThree = 0;
  364. layer.close(loadVideo);
  365. }
  366. }
  367. )
  368. //自适应高度
  369. parent.layer.iframeAuto(layerIndex);
  370. })
  371. //认证完成
  372. $('.Five').click(function(){
  373. parent.layer.close(layerIndex);
  374. })
  375. /**
  376. *以下是js 调用 as 方法
  377. */
  378. var microsoftStr= "Microsoft";
  379. function getFlashMovie(movieName)
  380. {
  381. var isIE = navigator.appName.indexOf(microsoftStr) != -1;
  382. return (isIE) ? window[movieName] : document[movieName];
  383. }
  384. //初始化,预览
  385. function publishLoaded(){
  386. closePublishSign = 1;
  387. getFlashMovie('publish').previewVideo();
  388. }
  389. //开始推流
  390. function startPublish(obj){
  391. getFlashMovie('publish').startPublish(obj);
  392. }
  393. //停止推流
  394. function closePublish(){
  395. closePublishSign = 0;
  396. $('.videoBtnNum').text(second);
  397. getFlashMovie('publish').closePublish();
  398. $('.record').hide();
  399. $('.endRecording').hide();
  400. $('.load').show();
  401. setTimeout('getRecordUrl()',1000);
  402. }
  403. //检查摄像头
  404. function existCamera(){
  405. $('.startRecording').show();
  406. }
  407. //预览
  408. function previewVideo(){
  409. $('.Three').removeClass('verificationNext').addClass('verificationNextGray');
  410. $('.Preview').hide();
  411. $('.record').show();
  412. }
  413. //测速
  414. var networkNum = 0;
  415. function publishNetStreamInfo(info){
  416. //网络差
  417. if(parseFloat(info.bufferLength)>2){
  418. stopTimer = 0;
  419. closeTime = 1;
  420. second = 30;//初始化倒计时
  421. getFlashMovie('publish').closePublish();
  422. $('#publish').hide();
  423. $('.endRecording').hide();
  424. $('.disconnect').show();
  425. $('.goPreview').show();
  426. }
  427. }
  428. //视频发布成功
  429. function streamPublishSuccess(){
  430. Timer();
  431. }
  432. //错误信息
  433. function errorPublishMsg(data){
  434. if(closePublishSign){
  435. if(data.errorcode == 'error_1001'){
  436. $('.video').hide();
  437. $('.noVideo').show();
  438. $('.Three').removeClass('verificationNextGray').addClass('verificationNext');
  439. $('.Three').html('<span>RELOAD PAGE</span>');
  440. $('.Three').addClass('reload');
  441. //刷新页面
  442. $('.reload').on('click',function(){
  443. window.location.reload();
  444. });
  445. }else{
  446. $('#publish').hide();
  447. $('.endRecording').hide();
  448. $('.disconnect').show();
  449. $('.goPreview').show();
  450. }
  451. stopTimer = 0; //停止定时器标识符
  452. second = 30;//初始化倒计时
  453. }
  454. }
  455. //推流
  456. var streamid = 0;
  457. var initData = '';//推流信息
  458. $('.startRecording').click(function(){
  459. if($('#publish').is(":hidden")){
  460. $('#publish').show();
  461. $('.disconnect').hide();
  462. }
  463. $('.startRecording').hide();
  464. $('.endRecording').show();
  465. closeTime = 0;//开启定时器
  466. second = 30;//初始化倒计时
  467. if(!streamid){
  468. $.get('/broadcast/authenticationLayer/initApproveAjax', {}, function(data){
  469. if(data.errno == 0){
  470. streamid = data.data.streamid;
  471. initData = data.data;
  472. startPublish(initData);
  473. }
  474. })
  475. }else{
  476. startPublish(initData);
  477. }
  478. })
  479. //30秒定时器
  480. var second = 30;
  481. var closeTime = 0;
  482. function Timer(){
  483. second -= 1;
  484. $('.videoBtnNum').text(second);
  485. if(second <= 0 || stopTimer){
  486. stopTimer = 0;//初始化停止定时器标识符
  487. second = 30;//初始化倒计时
  488. closePublish();
  489. }else {
  490. if(!closeTime){
  491. setTimeout('Timer()',1000)
  492. }
  493. }
  494. }
  495. //关闭
  496. var closePublishSign = 1;
  497. var record_url = '';
  498. var stopTimer = 0; //停止定时器标识符
  499. $('.endRecording').click(function(){
  500. stopTimer = 1;
  501. closeTime = 1;
  502. })
  503. //轮询获取RecordUrl
  504. function getRecordUrl(){
  505. $.get('/broadcast/authenticationLayer/getRecordUrlAjax', {streamid:streamid}, function(data){
  506. if(data.errno == 0){
  507. stopTimer = 0;//初始化停止定时器标识符
  508. second = 30;//初始化倒计时
  509. $('.videoBtnNum').text(second);
  510. record_url = data.data;
  511. $('.load').hide();
  512. $('.Three').removeClass('verificationNextGray').addClass('verificationNext');
  513. $('.Preview').show();
  514. $('#PreviewVideo').attr('src',record_url);
  515. }else{
  516. setTimeout('getRecordUrl()',1000)
  517. }
  518. })
  519. }
  520. //预览
  521. $('.deleteVideo').click(function(){
  522. record_url = '';
  523. previewVideo();
  524. })
  525. //出错后,重新预览
  526. $('.goPreview').click(function(){
  527. record_url = '';
  528. $('.goPreview').hide();
  529. $('.disconnect').hide();
  530. $('#publish').show();
  531. previewVideo();
  532. })
  533. //video预览,第三步
  534. $('.PlayVideo').click(function(){
  535. $('#PreviewVideo')[0].play();
  536. $('.PreviewMasking').hide();
  537. $('.PlayVideo').hide();
  538. $('.deleteVideo').hide();
  539. })
  540. //预览结束显示按钮
  541. function showPlayVideo(){
  542. $('.PreviewMasking').show();
  543. $('.PlayVideo').show();
  544. $('.deleteVideo').show();
  545. }
  546. //video预览,第四步
  547. $('.PlayVideoFour').click(function(){
  548. $('#PreviewVideoFour')[0].play();
  549. $('.PreviewMaskingFour').hide();
  550. $('.PlayVideoFour').hide();
  551. })
  552. //预览结束显示按钮
  553. function showPlayVideoFour(){
  554. $('.PreviewMaskingFour').show();
  555. $('.PlayVideoFour').show();
  556. }
  557. </script>