aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/standalone/videos')
-rw-r--r--client/src/standalone/videos/embed.html22
1 files changed, 16 insertions, 6 deletions
diff --git a/client/src/standalone/videos/embed.html b/client/src/standalone/videos/embed.html
index 365dc3fa2..d4bb74263 100644
--- a/client/src/standalone/videos/embed.html
+++ b/client/src/standalone/videos/embed.html
@@ -71,7 +71,7 @@
71 xhttp.send() 71 xhttp.send()
72 } 72 }
73 73
74 function loadVideoTorrent (magnetUri) { 74 function loadVideoTorrent (magnetUri, player) {
75 console.log('Loading video ' + videoId) 75 console.log('Loading video ' + videoId)
76 var client = new window.WebTorrent() 76 var client = new window.WebTorrent()
77 77
@@ -79,7 +79,19 @@
79 client.add(magnetUri, function (torrent) { 79 client.add(magnetUri, function (torrent) {
80 var file = torrent.files[0] 80 var file = torrent.files[0]
81 81
82 file.renderTo('video', { autoplay: true }) 82 file.renderTo('video', function (err) {
83 if (err) {
84 console.error(err)
85 return
86 }
87
88 // Hack to "simulate" src link in video.js >= 6
89 // If no, we can't play the video after pausing it
90 // https://github.com/videojs/video.js/blob/master/src/js/player.js#L1633
91 player.src = function () { return true }
92
93 player.play()
94 })
83 }) 95 })
84 } 96 }
85 97
@@ -127,13 +139,11 @@
127 }) 139 })
128 140
129 document.querySelector('.vjs-big-play-button').addEventListener('click', function () { 141 document.querySelector('.vjs-big-play-button').addEventListener('click', function () {
130 loadVideoTorrent(magnetUri) 142 loadVideoTorrent(magnetUri, player)
131
132 player.play()
133 }, false) 143 }, false)
134 }) 144 })
135 }) 145 })
136 146
137 </script> 147 </script>
138 </body> 148 </body>
139</html> 149</html