Gary Katsevman
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
35 additions and
1 deletions
-
src/source-updater.js
-
src/videojs-http-streaming.js
-
test/videojs-http-streaming.test.js
|
|
@ -428,12 +428,23 @@ export default class SourceUpdater extends videojs.EventTarget { |
|
|
|
* @return {boolean} |
|
|
|
* if changeType can be called. |
|
|
|
*/ |
|
|
|
canChangeType() { |
|
|
|
static canChangeType() { |
|
|
|
return window.SourceBuffer && |
|
|
|
window.SourceBuffer.prototype && |
|
|
|
typeof window.SourceBuffer.prototype.changeType === 'function'; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Whether or not the changeType function is supported |
|
|
|
* on our SourceBuffers. |
|
|
|
* |
|
|
|
* @return {boolean} |
|
|
|
* if changeType can be called. |
|
|
|
*/ |
|
|
|
canChangeType() { |
|
|
|
return this.constructor.canChangeType(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Call the changeType function on a source buffer, given the code and type. |
|
|
|
* |
|
|
|
|
|
@ -21,6 +21,7 @@ import { MasterPlaylistController } from './master-playlist-controller'; |
|
|
|
import Config from './config'; |
|
|
|
import renditionSelectionMixin from './rendition-mixin'; |
|
|
|
import PlaybackWatcher from './playback-watcher'; |
|
|
|
import SourceUpdater from './source-updater'; |
|
|
|
import reloadSourceOnError from './reload-source-on-error'; |
|
|
|
import { |
|
|
|
lastBandwidthSelector, |
|
|
@ -902,6 +903,10 @@ class VhsHandler extends Component { |
|
|
|
return this.constructor.version(); |
|
|
|
} |
|
|
|
|
|
|
|
canChangeType() { |
|
|
|
return SourceUpdater.canChangeType(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Begin playing the video. |
|
|
|
*/ |
|
|
|
|
|
@ -192,6 +192,24 @@ QUnit.test('version is exported', function(assert) { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
QUnit.test('canChangeType is exported', function(assert) { |
|
|
|
this.player.src({ |
|
|
|
src: 'manifest/playlist.m3u8', |
|
|
|
type: 'application/vnd.apple.mpegurl' |
|
|
|
}); |
|
|
|
|
|
|
|
this.clock.tick(1); |
|
|
|
|
|
|
|
assert.ok(this.player.tech(true).vhs.canChangeType, 'canChangeType function'); |
|
|
|
|
|
|
|
const canChangeType = window.SourceBuffer && |
|
|
|
window.SourceBuffer.prototype && |
|
|
|
typeof window.SourceBuffer.prototype.changeType === 'function'; |
|
|
|
const assertion = canChangeType ? 'ok' : 'notOk'; |
|
|
|
|
|
|
|
assert[assertion](this.player.tech(true).vhs.canChangeType(), 'canChangeType is correct'); |
|
|
|
}); |
|
|
|
|
|
|
|
QUnit.test('deprecation warning is show when using player.hls', function(assert) { |
|
|
|
const oldWarn = videojs.log.warn; |
|
|
|
let warning = ''; |
|
|
|