mirror of
https://github.com/videojs/video.js.git
synced 2024-11-24 08:42:25 +02:00
Merge branch 'stable'
Conflicts: dist/video-js/video-js.css dist/video-js/video-js.min.css dist/video-js/video-js.swf dist/video-js/video.dev.js dist/video-js/video.js
This commit is contained in:
commit
342bdce748
@ -6,6 +6,9 @@ _(none)_
|
||||
|
||||
--------------------
|
||||
|
||||
## 4.7.2 (2014-08-14)
|
||||
* Fixed a case where timeupdate events were not firing, and fixed and issue with the Flash player version ([view](https://github.com/videojs/video.js/pull/1417))
|
||||
|
||||
## 4.7.1 (2014-08-06)
|
||||
* Fixed the broken bower.json config ([view](https://github.com/videojs/video.js/pull/1401))
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "video.js",
|
||||
"description": "An HTML5 and Flash video player with a common API and skin for both.",
|
||||
"version": "4.7.1",
|
||||
"version": "4.7.2",
|
||||
"main": [
|
||||
"dist/video-js/video.js",
|
||||
"dist/video-js/video-js.css"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "video.js",
|
||||
"description": "An HTML5 and Flash video player with a common API and skin for both.",
|
||||
"version": "4.7.1",
|
||||
"version": "4.7.2",
|
||||
"keywords": [
|
||||
"videojs",
|
||||
"html5",
|
||||
|
@ -345,7 +345,7 @@ _inherited from_: [src/js/component.js#L475](https://github.com/videojs/video.js
|
||||
> keep the controls showing, but that shouldn't be an issue. A touch and hold on
|
||||
> any controls will still keep the user active
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L45](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L45)
|
||||
_inherited from_: [src/js/media/media.js#L55](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L55)
|
||||
|
||||
---
|
||||
|
||||
@ -406,7 +406,7 @@ _inherited from_: [src/js/component.js#L540](https://github.com/videojs/video.js
|
||||
##### PARAMETERS:
|
||||
* __event__
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L132](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L132)
|
||||
_inherited from_: [src/js/media/media.js#L142](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L142)
|
||||
|
||||
---
|
||||
|
||||
@ -414,7 +414,7 @@ _inherited from_: [src/js/media/media.js#L132](https://github.com/videojs/video.
|
||||
> Handle a tap on the media element. By default it will toggle the user
|
||||
> activity state, which hides and shows the controls.
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L152](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L152)
|
||||
_inherited from_: [src/js/media/media.js#L162](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L162)
|
||||
|
||||
---
|
||||
|
||||
@ -534,7 +534,7 @@ _inherited from_: [src/js/component.js#L683](https://github.com/videojs/video.js
|
||||
> Remove the listeners used for click and tap controls. This is needed for
|
||||
> toggling to controls disabled, where a tap/touch should do nothing.
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L116](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L116)
|
||||
_inherited from_: [src/js/media/media.js#L126](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L126)
|
||||
|
||||
---
|
||||
|
||||
@ -544,7 +544,7 @@ _inherited from_: [src/js/media/media.js#L116](https://github.com/videojs/video.
|
||||
> Poster support for techs should be optional, so we don't want techs to
|
||||
> break if they don't have a way to set a poster.
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L162](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L162)
|
||||
_inherited from_: [src/js/media/media.js#L262](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L262)
|
||||
|
||||
---
|
||||
|
||||
|
@ -345,7 +345,7 @@ _inherited from_: [src/js/component.js#L475](https://github.com/videojs/video.js
|
||||
> keep the controls showing, but that shouldn't be an issue. A touch and hold on
|
||||
> any controls will still keep the user active
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L45](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L45)
|
||||
_inherited from_: [src/js/media/media.js#L55](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L55)
|
||||
|
||||
---
|
||||
|
||||
@ -406,7 +406,7 @@ _inherited from_: [src/js/component.js#L540](https://github.com/videojs/video.js
|
||||
##### PARAMETERS:
|
||||
* __event__
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L132](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L132)
|
||||
_inherited from_: [src/js/media/media.js#L142](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L142)
|
||||
|
||||
---
|
||||
|
||||
@ -414,7 +414,7 @@ _inherited from_: [src/js/media/media.js#L132](https://github.com/videojs/video.
|
||||
> Handle a tap on the media element. By default it will toggle the user
|
||||
> activity state, which hides and shows the controls.
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L152](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L152)
|
||||
_inherited from_: [src/js/media/media.js#L162](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L162)
|
||||
|
||||
---
|
||||
|
||||
@ -534,7 +534,7 @@ _inherited from_: [src/js/component.js#L683](https://github.com/videojs/video.js
|
||||
> Remove the listeners used for click and tap controls. This is needed for
|
||||
> toggling to controls disabled, where a tap/touch should do nothing.
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L116](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L116)
|
||||
_inherited from_: [src/js/media/media.js#L126](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L126)
|
||||
|
||||
---
|
||||
|
||||
@ -544,7 +544,7 @@ _inherited from_: [src/js/media/media.js#L116](https://github.com/videojs/video.
|
||||
> Poster support for techs should be optional, so we don't want techs to
|
||||
> break if they don't have a way to set a poster.
|
||||
|
||||
_inherited from_: [src/js/media/media.js#L162](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L162)
|
||||
_inherited from_: [src/js/media/media.js#L262](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L262)
|
||||
|
||||
---
|
||||
|
||||
|
@ -345,7 +345,7 @@ _inherited from_: [src/js/component.js#L475](https://github.com/videojs/video.js
|
||||
> keep the controls showing, but that shouldn't be an issue. A touch and hold on
|
||||
> any controls will still keep the user active
|
||||
|
||||
_defined in_: [src/js/media/media.js#L45](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L45)
|
||||
_defined in_: [src/js/media/media.js#L55](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L55)
|
||||
|
||||
---
|
||||
|
||||
@ -406,7 +406,7 @@ _inherited from_: [src/js/component.js#L540](https://github.com/videojs/video.js
|
||||
##### PARAMETERS:
|
||||
* __event__
|
||||
|
||||
_defined in_: [src/js/media/media.js#L132](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L132)
|
||||
_defined in_: [src/js/media/media.js#L142](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L142)
|
||||
|
||||
---
|
||||
|
||||
@ -414,7 +414,7 @@ _defined in_: [src/js/media/media.js#L132](https://github.com/videojs/video.js/b
|
||||
> Handle a tap on the media element. By default it will toggle the user
|
||||
> activity state, which hides and shows the controls.
|
||||
|
||||
_defined in_: [src/js/media/media.js#L152](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L152)
|
||||
_defined in_: [src/js/media/media.js#L162](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L162)
|
||||
|
||||
---
|
||||
|
||||
@ -534,7 +534,7 @@ _inherited from_: [src/js/component.js#L683](https://github.com/videojs/video.js
|
||||
> Remove the listeners used for click and tap controls. This is needed for
|
||||
> toggling to controls disabled, where a tap/touch should do nothing.
|
||||
|
||||
_defined in_: [src/js/media/media.js#L116](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L116)
|
||||
_defined in_: [src/js/media/media.js#L126](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L126)
|
||||
|
||||
---
|
||||
|
||||
@ -544,7 +544,7 @@ _defined in_: [src/js/media/media.js#L116](https://github.com/videojs/video.js/b
|
||||
> Poster support for techs should be optional, so we don't want techs to
|
||||
> break if they don't have a way to set a poster.
|
||||
|
||||
_defined in_: [src/js/media/media.js#L162](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L162)
|
||||
_defined in_: [src/js/media/media.js#L262](https://github.com/videojs/video.js/blob/master/src/js/media/media.js#L262)
|
||||
|
||||
---
|
||||
|
||||
|
@ -171,7 +171,7 @@ _inherited from_: [src/js/component.js#L672](https://github.com/videojs/video.js
|
||||
##### RETURNS:
|
||||
* `Object` A mock TimeRange object (following HTML spec)
|
||||
|
||||
_defined in_: [src/js/player.js#L856](https://github.com/videojs/video.js/blob/master/src/js/player.js#L856)
|
||||
_defined in_: [src/js/player.js#L743](https://github.com/videojs/video.js/blob/master/src/js/player.js#L743)
|
||||
|
||||
---
|
||||
|
||||
@ -183,7 +183,7 @@ _defined in_: [src/js/player.js#L856](https://github.com/videojs/video.js/blob/m
|
||||
##### RETURNS:
|
||||
* `Number` The end of the last buffered time range
|
||||
|
||||
_defined in_: [src/js/player.js#L907](https://github.com/videojs/video.js/blob/master/src/js/player.js#L907)
|
||||
_defined in_: [src/js/player.js#L794](https://github.com/videojs/video.js/blob/master/src/js/player.js#L794)
|
||||
|
||||
---
|
||||
|
||||
@ -198,7 +198,7 @@ _defined in_: [src/js/player.js#L907](https://github.com/videojs/video.js/blob/m
|
||||
##### RETURNS:
|
||||
* `Number` A decimal between 0 and 1 representing the percent
|
||||
|
||||
_defined in_: [src/js/player.js#L876](https://github.com/videojs/video.js/blob/master/src/js/player.js#L876)
|
||||
_defined in_: [src/js/player.js#L763](https://github.com/videojs/video.js/blob/master/src/js/player.js#L763)
|
||||
|
||||
---
|
||||
|
||||
@ -216,7 +216,7 @@ _inherited from_: [src/js/component.js#L515](https://github.com/videojs/video.js
|
||||
> Old naming for exitFullscreen
|
||||
**Deprecated** true
|
||||
|
||||
_defined in_: [src/js/player.js#L1112](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1112)
|
||||
_defined in_: [src/js/player.js#L999](https://github.com/videojs/video.js/blob/master/src/js/player.js#L999)
|
||||
|
||||
---
|
||||
|
||||
@ -252,7 +252,7 @@ _inherited from_: [src/js/component.js#L233](https://github.com/videojs/video.js
|
||||
##### RETURNS:
|
||||
* `Boolean` Controls are showing
|
||||
|
||||
_defined in_: [src/js/player.js#L1387](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1387)
|
||||
_defined in_: [src/js/player.js#L1274](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1274)
|
||||
|
||||
---
|
||||
|
||||
@ -286,7 +286,7 @@ _inherited from_: [src/js/component.js#L194](https://github.com/videojs/video.js
|
||||
* `Number` The time in seconds, when not setting
|
||||
* `vjs.Player` self, when the current time is set
|
||||
|
||||
_defined in_: [src/js/player.js#L780](https://github.com/videojs/video.js/blob/master/src/js/player.js#L780)
|
||||
_defined in_: [src/js/player.js#L670](https://github.com/videojs/video.js/blob/master/src/js/player.js#L670)
|
||||
|
||||
---
|
||||
|
||||
@ -298,7 +298,7 @@ _defined in_: [src/js/player.js#L780](https://github.com/videojs/video.js/blob/m
|
||||
##### RETURNS:
|
||||
* `String` The source MIME type
|
||||
|
||||
_defined in_: [src/js/player.js#L1308](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1308)
|
||||
_defined in_: [src/js/player.js#L1195](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1195)
|
||||
|
||||
---
|
||||
|
||||
@ -343,7 +343,7 @@ _defined in_: [src/js/player.js#L156](https://github.com/videojs/video.js/blob/m
|
||||
##### RETURNS:
|
||||
* `Number` The duration of the video in seconds
|
||||
|
||||
_defined in_: [src/js/player.js#L811](https://github.com/videojs/video.js/blob/master/src/js/player.js#L811)
|
||||
_defined in_: [src/js/player.js#L698](https://github.com/videojs/video.js/blob/master/src/js/player.js#L698)
|
||||
|
||||
---
|
||||
|
||||
@ -396,7 +396,7 @@ _inherited from_: [src/js/component.js#L963](https://github.com/videojs/video.js
|
||||
* `vjs.MediaError|null` when getting
|
||||
* `vjs.Player` when setting
|
||||
|
||||
_defined in_: [src/js/player.js#L1472](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1472)
|
||||
_defined in_: [src/js/player.js#L1359](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1359)
|
||||
|
||||
---
|
||||
|
||||
@ -408,7 +408,7 @@ _defined in_: [src/js/player.js#L1472](https://github.com/videojs/video.js/blob/
|
||||
##### RETURNS:
|
||||
* `vjs.Player` self
|
||||
|
||||
_defined in_: [src/js/player.js#L1091](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1091)
|
||||
_defined in_: [src/js/player.js#L978](https://github.com/videojs/video.js/blob/master/src/js/player.js#L978)
|
||||
|
||||
---
|
||||
|
||||
@ -536,7 +536,7 @@ _inherited from_: [src/js/component.js#L475](https://github.com/videojs/video.js
|
||||
##### PARAMETERS:
|
||||
* __isFS__
|
||||
|
||||
_defined in_: [src/js/player.js#L1014](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1014)
|
||||
_defined in_: [src/js/player.js#L901](https://github.com/videojs/video.js/blob/master/src/js/player.js#L901)
|
||||
|
||||
---
|
||||
|
||||
@ -560,7 +560,7 @@ _defined in_: [src/js/player.js#L1014](https://github.com/videojs/video.js/blob/
|
||||
* `Boolean` true if fullscreen, false if not
|
||||
* `vjs.Player` self, when setting
|
||||
|
||||
_defined in_: [src/js/player.js#L1002](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1002)
|
||||
_defined in_: [src/js/player.js#L889](https://github.com/videojs/video.js/blob/master/src/js/player.js#L889)
|
||||
|
||||
---
|
||||
|
||||
@ -594,7 +594,7 @@ _defined in_: [src/js/player.js#L116](https://github.com/videojs/video.js/blob/m
|
||||
* `Boolean` True if mute is on, false if not, when getting
|
||||
* `vjs.Player` self, when setting mute
|
||||
|
||||
_defined in_: [src/js/player.js#L964](https://github.com/videojs/video.js/blob/master/src/js/player.js#L964)
|
||||
_defined in_: [src/js/player.js#L851](https://github.com/videojs/video.js/blob/master/src/js/player.js#L851)
|
||||
|
||||
---
|
||||
|
||||
@ -653,7 +653,7 @@ _inherited from_: [src/js/component.js#L540](https://github.com/videojs/video.js
|
||||
> A handler for events that signal that waiting has eneded
|
||||
> which is not consistent between browsers. See #1351
|
||||
|
||||
_defined in_: [src/js/player.js#L549](https://github.com/videojs/video.js/blob/master/src/js/player.js#L549)
|
||||
_defined in_: [src/js/player.js#L439](https://github.com/videojs/video.js/blob/master/src/js/player.js#L439)
|
||||
|
||||
---
|
||||
|
||||
@ -727,7 +727,7 @@ _inherited from_: [src/js/component.js#L173](https://github.com/videojs/video.js
|
||||
##### RETURNS:
|
||||
* `vjs.Player` self
|
||||
|
||||
_defined in_: [src/js/player.js#L749](https://github.com/videojs/video.js/blob/master/src/js/player.js#L749)
|
||||
_defined in_: [src/js/player.js#L639](https://github.com/videojs/video.js/blob/master/src/js/player.js#L639)
|
||||
|
||||
---
|
||||
|
||||
@ -740,7 +740,7 @@ _defined in_: [src/js/player.js#L749](https://github.com/videojs/video.js/blob/m
|
||||
##### RETURNS:
|
||||
* `Boolean` false if the media is currently playing, or true otherwise
|
||||
|
||||
_defined in_: [src/js/player.js#L762](https://github.com/videojs/video.js/blob/master/src/js/player.js#L762)
|
||||
_defined in_: [src/js/player.js#L652](https://github.com/videojs/video.js/blob/master/src/js/player.js#L652)
|
||||
|
||||
---
|
||||
|
||||
@ -752,7 +752,7 @@ _defined in_: [src/js/player.js#L762](https://github.com/videojs/video.js/blob/m
|
||||
##### RETURNS:
|
||||
* `vjs.Player` self
|
||||
|
||||
_defined in_: [src/js/player.js#L737](https://github.com/videojs/video.js/blob/master/src/js/player.js#L737)
|
||||
_defined in_: [src/js/player.js#L627](https://github.com/videojs/video.js/blob/master/src/js/player.js#L627)
|
||||
|
||||
---
|
||||
|
||||
@ -784,7 +784,7 @@ _inherited from_: [src/js/component.js#L120](https://github.com/videojs/video.js
|
||||
* `String` poster URL when getting
|
||||
* `vjs.Player` self when setting
|
||||
|
||||
_defined in_: [src/js/player.js#L1360](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1360)
|
||||
_defined in_: [src/js/player.js#L1247](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1247)
|
||||
|
||||
---
|
||||
|
||||
@ -832,7 +832,7 @@ _inherited from_: [src/js/component.js#L683](https://github.com/videojs/video.js
|
||||
> Old naming for requestFullscreen
|
||||
**Deprecated** true
|
||||
|
||||
_defined in_: [src/js/player.js#L1078](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1078)
|
||||
_defined in_: [src/js/player.js#L965](https://github.com/videojs/video.js/blob/master/src/js/player.js#L965)
|
||||
|
||||
---
|
||||
|
||||
@ -851,7 +851,7 @@ _defined in_: [src/js/player.js#L1078](https://github.com/videojs/video.js/blob/
|
||||
##### RETURNS:
|
||||
* `vjs.Player` self
|
||||
|
||||
_defined in_: [src/js/player.js#L1033](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1033)
|
||||
_defined in_: [src/js/player.js#L920](https://github.com/videojs/video.js/blob/master/src/js/player.js#L920)
|
||||
|
||||
---
|
||||
|
||||
@ -900,7 +900,7 @@ _inherited from_: [src/js/component.js#L693](https://github.com/videojs/video.js
|
||||
* `String` The current video source when getting
|
||||
* `String` The player when setting
|
||||
|
||||
_defined in_: [src/js/player.js#L1222](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1222)
|
||||
_defined in_: [src/js/player.js#L1109](https://github.com/videojs/video.js/blob/master/src/js/player.js#L1109)
|
||||
|
||||
---
|
||||
|
||||
@ -948,7 +948,7 @@ _inherited from_: [src/js/component.js#L644](https://github.com/videojs/video.js
|
||||
* `Number` The current volume, when getting
|
||||
* `vjs.Player` self, when setting
|
||||
|
||||
_defined in_: [src/js/player.js#L934](https://github.com/videojs/video.js/blob/master/src/js/player.js#L934)
|
||||
_defined in_: [src/js/player.js#L821](https://github.com/videojs/video.js/blob/master/src/js/player.js#L821)
|
||||
|
||||
---
|
||||
|
||||
@ -977,14 +977,14 @@ _inherited from_: [src/js/component.js#L756](https://github.com/videojs/video.js
|
||||
### durationchange `EVENT`
|
||||
> Fired when the duration of the media resource is first known or changed
|
||||
|
||||
_defined in_: [src/js/player.js#L632](https://github.com/videojs/video.js/blob/master/src/js/player.js#L632)
|
||||
_defined in_: [src/js/player.js#L522](https://github.com/videojs/video.js/blob/master/src/js/player.js#L522)
|
||||
|
||||
---
|
||||
|
||||
### ended `EVENT`
|
||||
> Fired when the end of the media resource is reached (currentTime == duration)
|
||||
|
||||
_defined in_: [src/js/player.js#L621](https://github.com/videojs/video.js/blob/master/src/js/player.js#L621)
|
||||
_defined in_: [src/js/player.js#L511](https://github.com/videojs/video.js/blob/master/src/js/player.js#L511)
|
||||
|
||||
---
|
||||
|
||||
@ -995,63 +995,63 @@ _defined in_: [src/js/player.js#L621](https://github.com/videojs/video.js/blob/m
|
||||
> implementation yet, so use sparingly. If you don't have a reason to
|
||||
> prevent playback, use `myPlayer.one('play');` instead.
|
||||
|
||||
_defined in_: [src/js/player.js#L578](https://github.com/videojs/video.js/blob/master/src/js/player.js#L578)
|
||||
_defined in_: [src/js/player.js#L468](https://github.com/videojs/video.js/blob/master/src/js/player.js#L468)
|
||||
|
||||
---
|
||||
|
||||
### fullscreenchange `EVENT`
|
||||
> Fired when the player switches in or out of fullscreen mode
|
||||
|
||||
_defined in_: [src/js/player.js#L661](https://github.com/videojs/video.js/blob/master/src/js/player.js#L661)
|
||||
_defined in_: [src/js/player.js#L551](https://github.com/videojs/video.js/blob/master/src/js/player.js#L551)
|
||||
|
||||
---
|
||||
|
||||
### loadedalldata `EVENT`
|
||||
> Fired when the player has finished downloading the source data
|
||||
|
||||
_defined in_: [src/js/player.js#L526](https://github.com/videojs/video.js/blob/master/src/js/player.js#L526)
|
||||
_defined in_: [src/js/player.js#L416](https://github.com/videojs/video.js/blob/master/src/js/player.js#L416)
|
||||
|
||||
---
|
||||
|
||||
### loadeddata `EVENT`
|
||||
> Fired when the player has downloaded data at the current playback position
|
||||
|
||||
_defined in_: [src/js/player.js#L520](https://github.com/videojs/video.js/blob/master/src/js/player.js#L520)
|
||||
_defined in_: [src/js/player.js#L410](https://github.com/videojs/video.js/blob/master/src/js/player.js#L410)
|
||||
|
||||
---
|
||||
|
||||
### loadedmetadata `EVENT`
|
||||
> Fired when the player has initial duration and dimension information
|
||||
|
||||
_defined in_: [src/js/player.js#L514](https://github.com/videojs/video.js/blob/master/src/js/player.js#L514)
|
||||
_defined in_: [src/js/player.js#L404](https://github.com/videojs/video.js/blob/master/src/js/player.js#L404)
|
||||
|
||||
---
|
||||
|
||||
### loadstart `EVENT`
|
||||
> Fired when the user agent begins looking for media data
|
||||
|
||||
_defined in_: [src/js/player.js#L470](https://github.com/videojs/video.js/blob/master/src/js/player.js#L470)
|
||||
_defined in_: [src/js/player.js#L360](https://github.com/videojs/video.js/blob/master/src/js/player.js#L360)
|
||||
|
||||
---
|
||||
|
||||
### pause `EVENT`
|
||||
> Fired whenever the media has been paused
|
||||
|
||||
_defined in_: [src/js/player.js#L592](https://github.com/videojs/video.js/blob/master/src/js/player.js#L592)
|
||||
_defined in_: [src/js/player.js#L482](https://github.com/videojs/video.js/blob/master/src/js/player.js#L482)
|
||||
|
||||
---
|
||||
|
||||
### play `EVENT`
|
||||
> Fired whenever the media begins or resumes playback
|
||||
|
||||
_defined in_: [src/js/player.js#L532](https://github.com/videojs/video.js/blob/master/src/js/player.js#L532)
|
||||
_defined in_: [src/js/player.js#L422](https://github.com/videojs/video.js/blob/master/src/js/player.js#L422)
|
||||
|
||||
---
|
||||
|
||||
### progress `EVENT`
|
||||
> Fired while the user agent is downloading media data
|
||||
|
||||
_defined in_: [src/js/player.js#L610](https://github.com/videojs/video.js/blob/master/src/js/player.js#L610)
|
||||
_defined in_: [src/js/player.js#L500](https://github.com/videojs/video.js/blob/master/src/js/player.js#L500)
|
||||
|
||||
---
|
||||
|
||||
@ -1065,14 +1065,14 @@ _inherited from_: [src/js/component.js#L863](https://github.com/videojs/video.js
|
||||
### seeked `EVENT`
|
||||
> Fired when the player has finished jumping to a new time
|
||||
|
||||
_defined in_: [src/js/player.js#L565](https://github.com/videojs/video.js/blob/master/src/js/player.js#L565)
|
||||
_defined in_: [src/js/player.js#L455](https://github.com/videojs/video.js/blob/master/src/js/player.js#L455)
|
||||
|
||||
---
|
||||
|
||||
### seeking `EVENT`
|
||||
> Fired whenever the player is jumping to a new time
|
||||
|
||||
_defined in_: [src/js/player.js#L557](https://github.com/videojs/video.js/blob/master/src/js/player.js#L557)
|
||||
_defined in_: [src/js/player.js#L447](https://github.com/videojs/video.js/blob/master/src/js/player.js#L447)
|
||||
|
||||
---
|
||||
|
||||
@ -1082,21 +1082,21 @@ _defined in_: [src/js/player.js#L557](https://github.com/videojs/video.js/blob/m
|
||||
> During playback this is fired every 15-250 milliseconds, depnding on the
|
||||
> playback technology in use.
|
||||
|
||||
_defined in_: [src/js/player.js#L604](https://github.com/videojs/video.js/blob/master/src/js/player.js#L604)
|
||||
_defined in_: [src/js/player.js#L494](https://github.com/videojs/video.js/blob/master/src/js/player.js#L494)
|
||||
|
||||
---
|
||||
|
||||
### volumechange `EVENT`
|
||||
> Fired when the volume changes
|
||||
|
||||
_defined in_: [src/js/player.js#L655](https://github.com/videojs/video.js/blob/master/src/js/player.js#L655)
|
||||
_defined in_: [src/js/player.js#L545](https://github.com/videojs/video.js/blob/master/src/js/player.js#L545)
|
||||
|
||||
---
|
||||
|
||||
### waiting `EVENT`
|
||||
> Fired whenever the media begins wating
|
||||
|
||||
_defined in_: [src/js/player.js#L541](https://github.com/videojs/video.js/blob/master/src/js/player.js#L541)
|
||||
_defined in_: [src/js/player.js#L431](https://github.com/videojs/video.js/blob/master/src/js/player.js#L431)
|
||||
|
||||
---
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "video.js",
|
||||
"description": "An HTML5 and Flash video player with a common API and skin for both.",
|
||||
"version": "4.7.1",
|
||||
"version": "4.7.2",
|
||||
"copyright": "Copyright 2014 Brightcove, Inc. https://github.com/videojs/video.js/blob/master/LICENSE",
|
||||
"keywords": [
|
||||
"videojs",
|
||||
@ -21,7 +21,7 @@
|
||||
},
|
||||
"main": "./dist/video-js/video.js",
|
||||
"dependencies": {
|
||||
"videojs-swf": "4.4.2"
|
||||
"videojs-swf": "4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"calcdeps": "~0.1.7",
|
||||
|
@ -756,15 +756,6 @@ vjs.parseUrl = function(url) {
|
||||
return details;
|
||||
};
|
||||
|
||||
// if there's no console then don't try to output messages
|
||||
// they will still be stored in vjs.log.history
|
||||
var _noop = function(){};
|
||||
var _console = window['console'] || {
|
||||
'log': _noop,
|
||||
'warn': _noop,
|
||||
'error': _noop
|
||||
};
|
||||
|
||||
/**
|
||||
* Log messags to the console and history based on the type of message
|
||||
*
|
||||
@ -773,8 +764,20 @@ var _console = window['console'] || {
|
||||
* @private
|
||||
*/
|
||||
function _logType(type, args){
|
||||
var argsArray, noop, console;
|
||||
|
||||
// convert args to an array to get array functions
|
||||
var argsArray = Array.prototype.slice.call(args);
|
||||
argsArray = Array.prototype.slice.call(args);
|
||||
// if there's no console then don't try to output messages
|
||||
// they will still be stored in vjs.log.history
|
||||
// Was setting these once outside of this function, but containing them
|
||||
// in the function makes it easier to test cases where console doesn't exist
|
||||
noop = function(){};
|
||||
console = window['console'] || {
|
||||
'log': noop,
|
||||
'warn': noop,
|
||||
'error': noop
|
||||
};
|
||||
|
||||
if (type) {
|
||||
// add the type to the front of the message
|
||||
@ -791,11 +794,11 @@ function _logType(type, args){
|
||||
argsArray.unshift('VIDEOJS:');
|
||||
|
||||
// call appropriate log function
|
||||
if (_console[type].apply) {
|
||||
_console[type].apply(_console, argsArray);
|
||||
if (console[type].apply) {
|
||||
console[type].apply(console, argsArray);
|
||||
} else {
|
||||
// ie8 doesn't allow error.apply, but it will just join() the array anyway
|
||||
_console[type](argsArray.join(' '));
|
||||
console[type](argsArray.join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,7 @@ vjs.Flash.prototype.src = function(src){
|
||||
vjs.Flash.prototype['setCurrentTime'] = function(time){
|
||||
this.lastSeekTarget_ = time;
|
||||
this.el_.vjs_setProperty('currentTime', time);
|
||||
vjs.MediaTechController.prototype.setCurrentTime.call(this);
|
||||
};
|
||||
|
||||
vjs.Flash.prototype['currentTime'] = function(time){
|
||||
|
@ -24,6 +24,9 @@ vjs.Html5 = vjs.MediaTechController.extend({
|
||||
// HTML video is able to automatically resize when going to fullscreen
|
||||
this.features['fullscreenResize'] = true;
|
||||
|
||||
// HTML video supports progress events
|
||||
this.features['progressEvents'] = true;
|
||||
|
||||
vjs.MediaTechController.call(this, player, options, ready);
|
||||
this.setupTriggers();
|
||||
|
||||
|
@ -18,6 +18,16 @@ vjs.MediaTechController = vjs.Component.extend({
|
||||
options.reportTouchActivity = false;
|
||||
vjs.Component.call(this, player, options, ready);
|
||||
|
||||
// Manually track progress in cases where the browser/flash player doesn't report it.
|
||||
if (!this.features['progressEvents']) {
|
||||
this.manualProgressOn();
|
||||
}
|
||||
|
||||
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
|
||||
if (!this.features['timeupdateEvents']) {
|
||||
this.manualTimeUpdatesOn();
|
||||
}
|
||||
|
||||
this.initControlsListeners();
|
||||
}
|
||||
});
|
||||
@ -153,6 +163,96 @@ vjs.MediaTechController.prototype.onTap = function(){
|
||||
this.player().userActive(!this.player().userActive());
|
||||
};
|
||||
|
||||
/* Fallbacks for unsupported event types
|
||||
================================================================================ */
|
||||
// Manually trigger progress events based on changes to the buffered amount
|
||||
// Many flash players and older HTML5 browsers don't send progress or progress-like events
|
||||
vjs.MediaTechController.prototype.manualProgressOn = function(){
|
||||
this.manualProgress = true;
|
||||
|
||||
// Trigger progress watching when a source begins loading
|
||||
this.trackProgress();
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.manualProgressOff = function(){
|
||||
this.manualProgress = false;
|
||||
this.stopTrackingProgress();
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.trackProgress = function(){
|
||||
|
||||
this.progressInterval = setInterval(vjs.bind(this, function(){
|
||||
// Don't trigger unless buffered amount is greater than last time
|
||||
|
||||
var bufferedPercent = this.player().bufferedPercent();
|
||||
|
||||
if (this.bufferedPercent_ != bufferedPercent) {
|
||||
this.player().trigger('progress');
|
||||
}
|
||||
|
||||
this.bufferedPercent_ = bufferedPercent;
|
||||
|
||||
if (bufferedPercent === 1) {
|
||||
this.stopTrackingProgress();
|
||||
}
|
||||
}), 500);
|
||||
};
|
||||
vjs.MediaTechController.prototype.stopTrackingProgress = function(){ clearInterval(this.progressInterval); };
|
||||
|
||||
/*! Time Tracking -------------------------------------------------------------- */
|
||||
vjs.MediaTechController.prototype.manualTimeUpdatesOn = function(){
|
||||
this.manualTimeUpdates = true;
|
||||
|
||||
this.player().on('play', vjs.bind(this, this.trackCurrentTime));
|
||||
this.player().on('pause', vjs.bind(this, this.stopTrackingCurrentTime));
|
||||
// timeupdate is also called by .currentTime whenever current time is set
|
||||
|
||||
// Watch for native timeupdate event
|
||||
this.one('timeupdate', function(){
|
||||
// Update known progress support for this playback technology
|
||||
this.features['timeupdateEvents'] = true;
|
||||
// Turn off manual progress tracking
|
||||
this.manualTimeUpdatesOff();
|
||||
});
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.manualTimeUpdatesOff = function(){
|
||||
this.manualTimeUpdates = false;
|
||||
this.stopTrackingCurrentTime();
|
||||
this.off('play', this.trackCurrentTime);
|
||||
this.off('pause', this.stopTrackingCurrentTime);
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.trackCurrentTime = function(){
|
||||
if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
|
||||
this.currentTimeInterval = setInterval(vjs.bind(this, function(){
|
||||
this.player().trigger('timeupdate');
|
||||
}), 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
|
||||
};
|
||||
|
||||
// Turn off play progress tracking (when paused or dragging)
|
||||
vjs.MediaTechController.prototype.stopTrackingCurrentTime = function(){
|
||||
clearInterval(this.currentTimeInterval);
|
||||
|
||||
// #1002 - if the video ends right before the next timeupdate would happen,
|
||||
// the progress bar won't make it all the way to the end
|
||||
this.player().trigger('timeupdate');
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.dispose = function() {
|
||||
// Turn off any manual progress or timeupdate tracking
|
||||
if (this.manualProgress) { this.manualProgressOff(); }
|
||||
|
||||
if (this.manualTimeUpdates) { this.manualTimeUpdatesOff(); }
|
||||
|
||||
vjs.Component.prototype.dispose.call(this);
|
||||
};
|
||||
|
||||
vjs.MediaTechController.prototype.setCurrentTime = function() {
|
||||
// improve the accuracy of manual timeupdates
|
||||
if (this.manualTimeUpdates) { this.player().trigger('timeupdate'); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Provide a default setPoster method for techs
|
||||
*
|
||||
|
113
src/js/player.js
113
src/js/player.js
@ -163,10 +163,6 @@ vjs.Player.prototype.dispose = function(){
|
||||
if (this.tag && this.tag['player']) { this.tag['player'] = null; }
|
||||
if (this.el_ && this.el_['player']) { this.el_['player'] = null; }
|
||||
|
||||
// Ensure that tracking progress and time progress will stop and plater deleted
|
||||
this.stopTrackingProgress();
|
||||
this.stopTrackingCurrentTime();
|
||||
|
||||
if (this.tech) { this.tech.dispose(); }
|
||||
|
||||
// Component dispose
|
||||
@ -311,16 +307,6 @@ vjs.Player.prototype.loadTech = function(techName, source){
|
||||
|
||||
var techReady = function(){
|
||||
this.player_.triggerReady();
|
||||
|
||||
// Manually track progress in cases where the browser/flash player doesn't report it.
|
||||
if (!this.features['progressEvents']) {
|
||||
this.player_.manualProgressOn();
|
||||
}
|
||||
|
||||
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
|
||||
if (!this.features['timeupdateEvents']) {
|
||||
this.player_.manualTimeUpdatesOn();
|
||||
}
|
||||
};
|
||||
|
||||
// Grab tech-specific options from player options and add source and parent element to use.
|
||||
@ -344,11 +330,6 @@ vjs.Player.prototype.loadTech = function(techName, source){
|
||||
vjs.Player.prototype.unloadTech = function(){
|
||||
this.isReady_ = false;
|
||||
|
||||
// Turn off any manual progress or timeupdate tracking
|
||||
if (this.manualProgress) { this.manualProgressOff(); }
|
||||
|
||||
if (this.manualTimeUpdates) { this.manualTimeUpdatesOff(); }
|
||||
|
||||
this.tech.dispose();
|
||||
|
||||
this.tech = false;
|
||||
@ -368,98 +349,7 @@ vjs.Player.prototype.unloadTech = function(){
|
||||
// vjs.log('loadedTech')
|
||||
// },
|
||||
|
||||
/* Fallbacks for unsupported event types
|
||||
================================================================================ */
|
||||
// Manually trigger progress events based on changes to the buffered amount
|
||||
// Many flash players and older HTML5 browsers don't send progress or progress-like events
|
||||
vjs.Player.prototype.manualProgressOn = function(){
|
||||
this.manualProgress = true;
|
||||
|
||||
// Trigger progress watching when a source begins loading
|
||||
this.trackProgress();
|
||||
|
||||
// Watch for a native progress event call on the tech element
|
||||
// In HTML5, some older versions don't support the progress event
|
||||
// So we're assuming they don't, and turning off manual progress if they do.
|
||||
// As opposed to doing user agent detection
|
||||
if (this.tech) {
|
||||
this.tech.one('progress', function(){
|
||||
|
||||
// Update known progress support for this playback technology
|
||||
this.features['progressEvents'] = true;
|
||||
|
||||
// Turn off manual progress tracking
|
||||
this.player_.manualProgressOff();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
vjs.Player.prototype.manualProgressOff = function(){
|
||||
this.manualProgress = false;
|
||||
this.stopTrackingProgress();
|
||||
};
|
||||
|
||||
vjs.Player.prototype.trackProgress = function(){
|
||||
|
||||
this.progressInterval = setInterval(vjs.bind(this, function(){
|
||||
// Don't trigger unless buffered amount is greater than last time
|
||||
|
||||
var bufferedPercent = this.bufferedPercent();
|
||||
|
||||
if (this.cache_.bufferedPercent != bufferedPercent) {
|
||||
this.trigger('progress');
|
||||
}
|
||||
|
||||
this.cache_.bufferedPercent = bufferedPercent;
|
||||
|
||||
if (bufferedPercent == 1) {
|
||||
this.stopTrackingProgress();
|
||||
}
|
||||
}), 500);
|
||||
};
|
||||
vjs.Player.prototype.stopTrackingProgress = function(){ clearInterval(this.progressInterval); };
|
||||
|
||||
/*! Time Tracking -------------------------------------------------------------- */
|
||||
vjs.Player.prototype.manualTimeUpdatesOn = function(){
|
||||
this.manualTimeUpdates = true;
|
||||
|
||||
this.on('play', this.trackCurrentTime);
|
||||
this.on('pause', this.stopTrackingCurrentTime);
|
||||
// timeupdate is also called by .currentTime whenever current time is set
|
||||
|
||||
// Watch for native timeupdate event
|
||||
if (this.tech) {
|
||||
this.tech.one('timeupdate', function(){
|
||||
// Update known progress support for this playback technology
|
||||
this.features['timeupdateEvents'] = true;
|
||||
// Turn off manual progress tracking
|
||||
this.player_.manualTimeUpdatesOff();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
vjs.Player.prototype.manualTimeUpdatesOff = function(){
|
||||
this.manualTimeUpdates = false;
|
||||
this.stopTrackingCurrentTime();
|
||||
this.off('play', this.trackCurrentTime);
|
||||
this.off('pause', this.stopTrackingCurrentTime);
|
||||
};
|
||||
|
||||
vjs.Player.prototype.trackCurrentTime = function(){
|
||||
if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
|
||||
this.currentTimeInterval = setInterval(vjs.bind(this, function(){
|
||||
this.trigger('timeupdate');
|
||||
}), 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
|
||||
};
|
||||
|
||||
// Turn off play progress tracking (when paused or dragging)
|
||||
vjs.Player.prototype.stopTrackingCurrentTime = function(){
|
||||
clearInterval(this.currentTimeInterval);
|
||||
|
||||
// #1002 - if the video ends right before the next timeupdate would happen,
|
||||
// the progress bar won't make it all the way to the end
|
||||
this.trigger('timeupdate');
|
||||
};
|
||||
// /* Player event handlers (how the player reacts to certain events)
|
||||
// ================================================================================ */
|
||||
|
||||
@ -782,9 +672,6 @@ vjs.Player.prototype.currentTime = function(seconds){
|
||||
|
||||
this.techCall('setCurrentTime', seconds);
|
||||
|
||||
// improve the accuracy of manual timeupdates
|
||||
if (this.manualTimeUpdates) { this.trigger('timeupdate'); }
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
'test/unit/mediafaker.js',
|
||||
'test/unit/player.js',
|
||||
'test/unit/core.js',
|
||||
'test/unit/media.js',
|
||||
'test/unit/media.html5.js',
|
||||
'test/unit/controls.js',
|
||||
'test/unit/poster.js',
|
||||
|
@ -6,6 +6,8 @@ function sinon(){}
|
||||
sinon.stub = function(){};
|
||||
sinon.spy = function(){};
|
||||
sinon.mock = function(){};
|
||||
sinon.useFakeTimers = function(){};
|
||||
sinon.clock.tick = function(){};
|
||||
|
||||
Function.prototype.alwaysCalledOn = function(){};
|
||||
Function.prototype.alwaysCalledWith = function(){};
|
||||
|
@ -69,7 +69,9 @@ test('currentTime is the seek target during seeking', function() {
|
||||
parentEl = document.createElement('div'),
|
||||
tech = new vjs.Flash({
|
||||
id: noop,
|
||||
bufferedPercent: noop,
|
||||
on: noop,
|
||||
trigger: noop,
|
||||
options_: {}
|
||||
}, {
|
||||
'parentEl': parentEl
|
||||
@ -103,6 +105,7 @@ test('dispose removes the object element even before ready fires', function() {
|
||||
tech = new vjs.Flash({
|
||||
id: noop,
|
||||
on: noop,
|
||||
trigger: noop,
|
||||
options_: {}
|
||||
}, {
|
||||
'parentEl': parentEl
|
||||
|
@ -294,56 +294,54 @@ test('vjs.findPosition should find top and left position', function() {
|
||||
|
||||
// LOG TESTS
|
||||
test('should confirm logging functions work', function() {
|
||||
var console = window['console'];
|
||||
var origLog = console.log;
|
||||
var origWarn = console.warn;
|
||||
var origError = console.error;
|
||||
var console, log, error, warn, origConsole, origLog, origWarn, origError;
|
||||
|
||||
origConsole = window['console'];
|
||||
// replace the native console for testing
|
||||
// in ie8 console.log is apparently not a 'function' so sinon chokes on it
|
||||
// https://github.com/cjohansen/Sinon.JS/issues/386
|
||||
// instead we'll temporarily replace them with functions
|
||||
if (typeof origLog === 'object') {
|
||||
console.log = function(){};
|
||||
console.warn = function(){};
|
||||
console.error = function(){};
|
||||
}
|
||||
// instead we'll temporarily replace them with no-op functions
|
||||
console = window['console'] = {
|
||||
log: function(){},
|
||||
warn: function(){},
|
||||
error: function(){}
|
||||
};
|
||||
|
||||
// stub the global log functions
|
||||
var log = sinon.stub(console, 'log');
|
||||
var error = sinon.stub(console, 'error');
|
||||
var warn = sinon.stub(console, 'warn');
|
||||
log = sinon.stub(console, 'log');
|
||||
error = sinon.stub(console, 'error');
|
||||
warn = sinon.stub(console, 'warn');
|
||||
|
||||
vjs.log('log1', 'log2');
|
||||
vjs.log.warn('warn1', 'warn2');
|
||||
vjs.log.error('error1', 'error2');
|
||||
|
||||
vjs.log('asdf', 'fdsa');
|
||||
ok(log.called, 'log was called');
|
||||
equal(log.firstCall.args[0], 'VIDEOJS:');
|
||||
equal(log.firstCall.args[1], 'asdf');
|
||||
equal(log.firstCall.args[2], 'fdsa');
|
||||
equal(log.firstCall.args[1], 'log1');
|
||||
equal(log.firstCall.args[2], 'log2');
|
||||
|
||||
vjs.log.warn('asdf', 'fdsa');
|
||||
ok(warn.called, 'warn was called');
|
||||
equal(warn.firstCall.args[0], 'VIDEOJS:');
|
||||
equal(warn.firstCall.args[1], 'WARN:');
|
||||
equal(warn.firstCall.args[2], 'asdf');
|
||||
equal(warn.firstCall.args[3], 'fdsa');
|
||||
equal(warn.firstCall.args[2], 'warn1');
|
||||
equal(warn.firstCall.args[3], 'warn2');
|
||||
|
||||
vjs.log.error('asdf', 'fdsa');
|
||||
ok(error.called, 'error was called');
|
||||
equal(error.firstCall.args[0], 'VIDEOJS:');
|
||||
equal(error.firstCall.args[1], 'ERROR:');
|
||||
equal(error.firstCall.args[2], 'asdf');
|
||||
equal(error.firstCall.args[3], 'fdsa');
|
||||
equal(error.firstCall.args[2], 'error1');
|
||||
equal(error.firstCall.args[3], 'error2');
|
||||
|
||||
ok(vjs.log.history.length === 3, 'there should be three messages in the log history');
|
||||
|
||||
// tear down sinon
|
||||
log.restore();
|
||||
error.restore();
|
||||
warn.restore();
|
||||
|
||||
// restore ie8
|
||||
if (typeof origLog === 'object') {
|
||||
console.log = origLog;
|
||||
console.warn = origWarn;
|
||||
console.error = origError;
|
||||
}
|
||||
// restore the native console
|
||||
window['console'] = origConsole;
|
||||
});
|
||||
|
||||
test('should loop through each element of an array', function() {
|
||||
|
@ -11,11 +11,13 @@ module('HTML5', {
|
||||
el: function(){ return el; },
|
||||
options_: {},
|
||||
options: function(){ return {}; },
|
||||
bufferedPercent: function() { return 0; },
|
||||
controls: function(){ return false; },
|
||||
usingNativeControls: function(){ return false; },
|
||||
on: function(){ return this; },
|
||||
off: function() { return this; },
|
||||
ready: function(){}
|
||||
ready: function(){},
|
||||
trigger: function(){}
|
||||
};
|
||||
tech = new vjs.Html5(player, {});
|
||||
},
|
||||
|
117
test/unit/media.js
Normal file
117
test/unit/media.js
Normal file
@ -0,0 +1,117 @@
|
||||
var noop = function() {}, clock, features;
|
||||
|
||||
module('Media Tech', {
|
||||
'setup': function() {
|
||||
clock = sinon.useFakeTimers();
|
||||
features = videojs.util.mergeOptions({}, videojs.MediaTechController.prototype.features);
|
||||
videojs.MediaTechController.prototype.features['progressEvents'] = false;
|
||||
},
|
||||
'teardown': function() {
|
||||
clock.restore();
|
||||
videojs.MediaTechController.prototype.features = features;
|
||||
}
|
||||
});
|
||||
|
||||
test('should synthesize timeupdate events by default', function() {
|
||||
var timeupdates = 0, playHandler, i, tech;
|
||||
tech = new videojs.MediaTechController({
|
||||
id: noop,
|
||||
on: function(event, handler) {
|
||||
if (event === 'play') {
|
||||
playHandler = handler;
|
||||
}
|
||||
},
|
||||
trigger: function(event) {
|
||||
if (event === 'timeupdate') {
|
||||
timeupdates++;
|
||||
}
|
||||
}
|
||||
});
|
||||
playHandler.call(tech);
|
||||
tech.on('timeupdate', function() {
|
||||
timeupdates++;
|
||||
});
|
||||
|
||||
clock.tick(250);
|
||||
equal(timeupdates, 1, 'triggered one timeupdate');
|
||||
});
|
||||
|
||||
test('stops timeupdates if the tech produces them natively', function() {
|
||||
var timeupdates = 0, tech, playHandler, expected;
|
||||
tech = new videojs.MediaTechController({
|
||||
id: noop,
|
||||
on: function(event, handler) {
|
||||
if (event === 'play') {
|
||||
playHandler = handler;
|
||||
}
|
||||
},
|
||||
bufferedPercent: noop,
|
||||
trigger: function(event) {
|
||||
if (event === 'timeupdate') {
|
||||
timeupdates++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
playHandler.call(tech);
|
||||
// simulate a native timeupdate event
|
||||
tech.trigger('timeupdate');
|
||||
|
||||
expected = timeupdates;
|
||||
clock.tick(10 * 1000);
|
||||
equal(timeupdates, expected, 'did not simulate timeupdates');
|
||||
});
|
||||
|
||||
test('stops manual timeupdates while paused', function() {
|
||||
var timeupdates = 0, tech, playHandler, pauseHandler, expected;
|
||||
tech = new videojs.MediaTechController({
|
||||
id: noop,
|
||||
on: function(event, handler) {
|
||||
if (event === 'play') {
|
||||
playHandler = handler;
|
||||
} else if (event === 'pause') {
|
||||
pauseHandler = handler;
|
||||
}
|
||||
},
|
||||
bufferedPercent: noop,
|
||||
trigger: function(event) {
|
||||
if (event === 'timeupdate') {
|
||||
timeupdates++;
|
||||
}
|
||||
}
|
||||
});
|
||||
playHandler.call(tech);
|
||||
clock.tick(10 * 250);
|
||||
ok(timeupdates > 0, 'timeupdates fire during playback');
|
||||
|
||||
pauseHandler.call(tech);
|
||||
timeupdates = 0;
|
||||
clock.tick(10 * 250);
|
||||
equal(timeupdates, 0, 'timeupdates do not fire when paused');
|
||||
|
||||
playHandler.call(tech);
|
||||
clock.tick(10 * 250);
|
||||
ok(timeupdates > 0, 'timeupdates fire when playback resumes');
|
||||
});
|
||||
|
||||
test('should synthesize progress events by default', function() {
|
||||
var progresses = 0, tech;
|
||||
tech = new videojs.MediaTechController({
|
||||
id: noop,
|
||||
on: noop,
|
||||
bufferedPercent: function() {
|
||||
return 0;
|
||||
},
|
||||
trigger: function(event) {
|
||||
if (event === 'progress') {
|
||||
progresses++;
|
||||
}
|
||||
}
|
||||
});
|
||||
tech.on('progress', function() {
|
||||
progresses++;
|
||||
});
|
||||
|
||||
clock.tick(500);
|
||||
equal(progresses, 1, 'triggered one event');
|
||||
});
|
Loading…
Reference in New Issue
Block a user