mirror of
https://github.com/videojs/video.js.git
synced 2024-11-28 08:58:46 +02:00
@dmlap fixed an error caused by calling vjs_getProperty on the swf too early. closes #2289
This commit is contained in:
parent
c43863edbd
commit
c2820e9e38
@ -4,6 +4,7 @@ CHANGELOG
|
||||
## HEAD (Unreleased)
|
||||
* @saxena-gaurav updated swf to 4.7.2 to fix flash of previous video frame ([view](https://github.com/videojs/video.js/pull/2300))
|
||||
* @gkatsev updated the vtt.js version to fix JSON issues ([view](https://github.com/videojs/video.js/pull/2327))
|
||||
* @dmlap fixed an error caused by calling vjs_getProperty on the swf too early ([view](https://github.com/videojs/video.js/pull/2289))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -174,9 +174,19 @@ vjs.Flash.prototype.seekable = function() {
|
||||
};
|
||||
|
||||
vjs.Flash.prototype.buffered = function(){
|
||||
if (!this.el_.vjs_getProperty) {
|
||||
return vjs.createTimeRange();
|
||||
}
|
||||
return vjs.createTimeRange(0, this.el_.vjs_getProperty('buffered'));
|
||||
};
|
||||
|
||||
vjs.Flash.prototype.duration = function(){
|
||||
if (!this.el_.vjs_getProperty) {
|
||||
return 0;
|
||||
}
|
||||
return this.el_.vjs_getProperty('duration');
|
||||
};
|
||||
|
||||
vjs.Flash.prototype.supportsFullScreen = function(){
|
||||
return false; // Flash does not allow fullscreen through javascript
|
||||
};
|
||||
@ -189,7 +199,7 @@ vjs.Flash.prototype.enterFullScreen = function(){
|
||||
// Create setters and getters for attributes
|
||||
var api = vjs.Flash.prototype,
|
||||
readWrite = 'rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(','),
|
||||
readOnly = 'error,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,ended,videoTracks,audioTracks,videoWidth,videoHeight'.split(','),
|
||||
readOnly = 'error,networkState,readyState,seeking,initialTime,startOffsetTime,paused,played,ended,videoTracks,audioTracks,videoWidth,videoHeight'.split(','),
|
||||
// Overridden: buffered, currentTime, currentSrc
|
||||
i;
|
||||
|
||||
|
@ -186,3 +186,17 @@ test('seekable should be empty if no video is loaded', function() {
|
||||
|
||||
equal(tech.seekable().length, 0, 'seekable is empty');
|
||||
});
|
||||
|
||||
test('calling methods before the SWF loads is safe', function() {
|
||||
var player = PlayerTest.makePlayer(),
|
||||
tech = new vjs.Flash(player, {
|
||||
'parentEl': player.el()
|
||||
});
|
||||
|
||||
// force Flash callbacks to be undefined as they would be before the
|
||||
// SWF is ready
|
||||
tech.el().vjs_getProperty = undefined;
|
||||
|
||||
equal(tech.buffered().length, 0, 'buffered percent is 0');
|
||||
equal(tech.duration(), 0, 'duration is 0');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user