|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | 3 | <head> |
4 | | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
5 | | - <meta http-equiv="X-UA-Compatible" value="IE=9"> |
6 | | - <link rel="stylesheet" href="../default.css" /> |
7 | | - <link rel="stylesheet" href="../build/base.css" /> |
8 | | - <!-- Files Below May Be Combined/Concated into one on Deployment Servers --> |
9 | | - <script src="../CommentFilter.js"></script> |
10 | | - <script src="../CommentSpaceAllocator.js"></script> |
11 | | - <script src="../CommentCoreLibrary.js"></script> |
12 | | - <!-- A few helpers to do some decoding/fetching below--> |
13 | | - <script src="../libxml.js"></script> |
14 | | - <script src="../parsers/BilibiliFormat.js"></script> |
15 | | - <title>Testrun Player</title> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 | + <meta http-equiv="X-UA-Compatible" value="IE=9"> |
| 6 | + <link rel="stylesheet" href="default.css" /> |
| 7 | + <link rel="stylesheet" href="../dist/css/style.css" /> |
| 8 | + <script src="../dist/CommentCoreLibrary.js"></script> |
| 9 | + <title>Testrun Player</title> |
16 | 10 | </head> |
17 | 11 | <body> |
18 | | - <div class="m20 abp" id="player"> |
19 | | - <div id="commentCanvas" class="container"></div> |
20 | | - <video id="abpVideo" height="100%" width="100%" poster="http://content.bitsontherun.com/thumbs/bkaovAYt-720.jpg" controls="none"> |
21 | | - <source src="http://content.bitsontherun.com/videos/bkaovAYt-52qL9xLP.mp4" type="video/mp4"> |
22 | | - <source src="http://content.bitsontherun.com/videos/bkaovAYt-27m5HpIu.webm" type="video/webm"> |
23 | | - <p class="warning">Your browser does not support HTML5 video.</p> |
24 | | - </video> |
25 | | - </div> |
26 | | - <script type="text/javascript"> |
27 | | - var cm = null; |
28 | | - var timer = 0; |
29 | | - function togglePlayback(){ |
30 | | - var videoPlayer = $('abpVideo'); |
31 | | - if (videoPlayer == null) |
32 | | - return; //Called when not fully loaded |
33 | | - if (videoPlayer.paused){ |
34 | | - if(cm != null){ |
35 | | - timer = setInterval(function(){ |
36 | | - cm.time(Math.round(videoPlayer.currentTime * 1000)); |
37 | | - },10); |
38 | | - } |
39 | | - cm.startTimer(); |
40 | | - videoPlayer.play(); |
41 | | - }else{ |
42 | | - if(cm != null){ |
43 | | - cm.stopTimer(); |
44 | | - clearTimeout(timer); |
45 | | - } |
46 | | - videoPlayer.pause(); |
47 | | - } |
48 | | - } |
49 | | - window.addEventListener("load",function(){ |
50 | | - //Hook basics |
51 | | - cm = new CommentManager($('commentCanvas')); |
52 | | - cm.init(); |
53 | | - cm.clear(); |
54 | | - try{ |
55 | | - clearTimeout(timer); |
56 | | - }catch(e){} |
57 | | - $('player').addEventListener("click",function(){ |
58 | | - togglePlayback(); |
59 | | - }); |
60 | | - CommentLoader("../tests/comment.xml",cm,'bilibili'); |
61 | | - cm.startTimer(); |
62 | | - }); |
63 | | - </script> |
| 12 | + <div class="m20 abp" id="player"> |
| 13 | + <div id="commentCanvas" class="container"></div> |
| 14 | + <video id="abpVideo" height="100%" width="100%" poster="http://content.bitsontherun.com/thumbs/bkaovAYt-720.jpg" controls="none"> |
| 15 | + <source src="http://content.bitsontherun.com/videos/bkaovAYt-52qL9xLP.mp4" type="video/mp4"> |
| 16 | + <source src="http://content.bitsontherun.com/videos/bkaovAYt-27m5HpIu.webm" type="video/webm"> |
| 17 | + <p class="warning">Your browser does not support HTML5 video.</p> |
| 18 | + </video> |
| 19 | + </div> |
| 20 | + <script type="text/javascript"> |
| 21 | + var $ = function(e) {return document.getElementById(e);}; |
| 22 | + var cm = null; |
| 23 | + var timer = 0; |
| 24 | + function togglePlayback () { |
| 25 | + var videoPlayer = $('abpVideo'); |
| 26 | + if (videoPlayer == null) { |
| 27 | + return; //Called when not fully loaded |
| 28 | + } |
| 29 | + if (videoPlayer.paused){ |
| 30 | + if(cm != null){ |
| 31 | + timer = setInterval(function () { |
| 32 | + cm.time(Math.round(videoPlayer.currentTime * 1000)); |
| 33 | + }, 10); |
| 34 | + } |
| 35 | + cm.startTimer(); |
| 36 | + videoPlayer.play(); |
| 37 | + }else{ |
| 38 | + if(cm != null){ |
| 39 | + cm.stopTimer(); |
| 40 | + clearTimeout(timer); |
| 41 | + } |
| 42 | + videoPlayer.pause(); |
| 43 | + } |
| 44 | + } |
| 45 | + window.addEventListener("load",function () { |
| 46 | + //Hook basics |
| 47 | + cm = new CommentManager($('commentCanvas')); |
| 48 | + cm.init(); |
| 49 | + cm.start(); |
| 50 | + try{ |
| 51 | + clearTimeout(timer); |
| 52 | + }catch(e){ |
| 53 | + // Foo |
| 54 | + } |
| 55 | + $('player').addEventListener("click",function(){ |
| 56 | + togglePlayback(); |
| 57 | + }); |
| 58 | + var cp = (new CommentProvider()).addStaticSource( |
| 59 | + CommentProvider.XMLProvider("GET", "../test/comment.xml"), |
| 60 | + CommentProvider.SOURCE_XML).addParser( |
| 61 | + new BilibiliFormat.XMLParser(), |
| 62 | + CommentProvider.SOURCE_XML).addTarget(cm); |
| 63 | + cp.start().catch(function (e) { |
| 64 | + alert(e); |
| 65 | + }); |
| 66 | + cm.clear(); |
| 67 | + }); |
| 68 | + </script> |
64 | 69 | </body> |
65 | 70 | </html> |
0 commit comments