Update video.js to fix seeking and autoplay
Bump the required version of video.js up to 4.7.2 because the earlier version built the SWF for a version of Flash that had issues with appendBytes. Handle autoplay inside the tech itself because video.js support calls play before the Media Source has opened and the call ended up ignored. Fixes #112. Fixes #128.
Showing
3 changed files
with
12 additions
and
4 deletions
... | @@ -34,7 +34,7 @@ | ... | @@ -34,7 +34,7 @@ |
34 | "karma-safari-launcher": "~0.1.1", | 34 | "karma-safari-launcher": "~0.1.1", |
35 | "karma-sauce-launcher": "~0.1.8", | 35 | "karma-sauce-launcher": "~0.1.8", |
36 | "sinon": "1.10.2", | 36 | "sinon": "1.10.2", |
37 | "video.js": "git+https://github.com/dmlap/video-js.git#0.6.1-alpha" | 37 | "video.js": "^4.7.2" |
38 | }, | 38 | }, |
39 | "dependencies": { | 39 | "dependencies": { |
40 | "videojs-contrib-media-sources": "^0.3.0" | 40 | "videojs-contrib-media-sources": "^0.3.0" | ... | ... |
... | @@ -121,6 +121,13 @@ videojs.Hls.prototype.handleSourceOpen = function() { | ... | @@ -121,6 +121,13 @@ videojs.Hls.prototype.handleSourceOpen = function() { |
121 | this.playlists.on('mediachange', function() { | 121 | this.playlists.on('mediachange', function() { |
122 | player.trigger('mediachange'); | 122 | player.trigger('mediachange'); |
123 | }); | 123 | }); |
124 | |||
125 | // if autoplay is enabled, begin playback. This is duplicative of | ||
126 | // code in video.js but is required because play() must be invoked | ||
127 | // *after* the media source has opened. | ||
128 | if (player.options().autoplay) { | ||
129 | player.play(); | ||
130 | } | ||
124 | }; | 131 | }; |
125 | 132 | ||
126 | /** | 133 | /** | ... | ... |
... | @@ -160,14 +160,15 @@ module('HLS', { | ... | @@ -160,14 +160,15 @@ module('HLS', { |
160 | 160 | ||
161 | test('starts playing if autoplay is specified', function() { | 161 | test('starts playing if autoplay is specified', function() { |
162 | var plays = 0; | 162 | var plays = 0; |
163 | player.play = function() { | ||
164 | plays++; | ||
165 | }; | ||
166 | player.options().autoplay = true; | 163 | player.options().autoplay = true; |
167 | player.src({ | 164 | player.src({ |
168 | src: 'manifest/playlist.m3u8', | 165 | src: 'manifest/playlist.m3u8', |
169 | type: 'application/vnd.apple.mpegurl' | 166 | type: 'application/vnd.apple.mpegurl' |
170 | }); | 167 | }); |
168 | // make sure play() is called *after* the media source opens | ||
169 | player.play = function() { | ||
170 | plays++; | ||
171 | }; | ||
171 | openMediaSource(player); | 172 | openMediaSource(player); |
172 | 173 | ||
173 | standardXHRResponse(requests[0]); | 174 | standardXHRResponse(requests[0]); | ... | ... |
-
Please register or sign in to post a comment