1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-12 11:15:04 +02:00
Commit Graph

568 Commits

Author SHA1 Message Date
Oshin Karamian
083a86c363 feat: split overrideNative method into separate methods (#5107)
Split overrideNative method into one for Audio and Video. Fixes issues with differing track support in IE11.
2018-04-19 20:11:11 -04:00
Oshin Karamian
22bbbc948c feat: add tech method to allow override native audio and video (#5074) 2018-04-19 13:16:01 -04:00
axten
d0b03a3a0f fix: wait till play event to listen for user activity (#5093)
There is no need to listen for user activity until a play is requested on the player and it just adds an extra timer for a player that hasn't started playing yet. Instead, just wait till the first `play` event.

Closes #5076.
2018-04-19 11:57:32 -04:00
Chuck Wilson
a2851fe4bd feat: Queue playback events when the playback rate is zero and we are seeking (#5024)
SourceHandlers that use MSE have a problem: if they push a segment into a SourceBuffer and then seek close to the end, playback will stall and/or there will be a massive downswitch in quality. The general approach to fixing this that was discussed on slack was by setting the playback rate of the player to zero, buffering all that was required, and then restoring the previous playback rate. In my implementation, I've done this in the source handler (see: videojs/videojs-contrib-hls#1374).

From the video.js perspective, it should ensure that the UI reflects the buffering status and that the player API behaves like you'd expect -- that is to say, that it will fire seeking immediately after a call to currentTime, and it will fire seeked, canplay, canplaythrough, and playing when everything is buffered.
2018-04-17 15:28:35 -04:00
Brandon Casey
9eb5de7ec7 fix: fire sourceset on initial source append (#5038)
In Chrome/Firefox/Safari appending a <source> element when the media element has no source, causes what we think of as a `sourceset`. These changes make our code actual fire that event.
2018-04-02 16:06:47 -04:00
Brandon Casey
fdcae1b469 fix: let the tech preload auto on its own (#4861)
This was found due to the work done in #4660. Basically we reload the video element twice on every source with preload set to auto. This can potentially cause the same data to be downloaded twice.
2018-04-02 14:30:22 -04:00
Joe Forbes
d1b4768b05 feat: built-in HLS playback support (#5057)
This PR is to add HLS playback support built into video.js for 7.0 via videojs-http-streaming (shorthand VHS). VHS is the next major version of videojs-contrib-hls that removes HLS Flash playback and includes some experimental DASH support (hence the rename). The purpose is to improve the out-of-the-box experience for video.js and allow cross browser HLS compatibility.

The proposed changes are to have the standard video.js browser and module scripts contain VHS and provide an alternate video.js browser script that does not contain VHS.

A video.js/core export is provided for importing without VHS.
2018-03-30 14:01:16 -04:00
Gary Katsevman
44312bc060
chore(test): upgrade qunit and karma-qunit to latest (#5051)
Since we no longer support IE8, we can actually update our qunit version.
2018-03-26 10:40:59 -04:00
Joe Forbes
3798446f84 test: update karma browser OS versions (#5050) 2018-03-23 20:06:57 -04:00
Gary Katsevman
bc2da7c67b
refactor: remove IE8 specific changes (#5041)
BREAKING CHANGE: remove IE8, IE9, and IE10 specific JavaScript and CSS code. Remove Android 2.3 workaround.
2018-03-23 13:25:12 -04:00
Gary Katsevman
0a20d65c04
test: no longer test on IE8, IE9, or IE10 (#5032) 2018-03-19 17:14:56 -04:00
Gary Katsevman
1b3c827d5e
feat: require enableSourceset option for event (#5031)
While sourceset is experimental, require the option `enableSourceset`.
This can easily be reversed in a minor update.
2018-03-19 13:47:45 -04:00
Gary Katsevman
46d8b37385
fix(sourceset): set evt.src to empty string or src attr from load (#5016)
If .load() is called, we don't know what the new source will be because of the asynchronous nature of the resource selection algorithm. However, we can know if the src attribute is set on the video element because that's what will be chosen. So, set the src property on the event object to be the src attribute or be the empty string. This matches how currentSrc works where it is an empty string when no source is set. So, when sourceset is triggered and src is "" in the event object, it means that the source is changing.
In addition, we're going to be releasing sourceset as an experimental feature so we could improve the API and make changes in minor releases.
2018-03-15 15:05:41 -04:00
Gary Katsevman
4e83cd3e3f
test(ResizeManager): only listen for one playerresize to make test not flaky (#5022) 2018-03-15 11:16:42 -04:00
Viktor S
ba6a71eb01 fix: don't add captions settings menu item when TextTrackSettings is disabled (#5002)
Removes the CaptionsSettingsMenuItem when TextTrackSettings is not included.

Fixes #4996
2018-03-13 12:03:39 -04:00
twosmalltrees
2f96914b8e feat(format time): add setFormatTime for overriding the time format (#4962)
Add setFormatTime for Video.js to allow users to change the time format. Example usage:

```js
videojs.setFormatTime((seconds, guide) => `${seconds}, ${guide}`));
```

Add resetFormatTime to reset the time format to the default.

Fixes #2931
2018-03-07 14:37:10 -05:00
David GG
62ff3f66a5 feat: add mimetype type to source object when possible (#4469) (#4947)
File mimetype is filled when the file extension is known and type is not provided.

Fixes #4469, improves #4851.
2018-03-07 14:34:16 -05:00
Michael Vogel
8706941573 feat: Allow techs to change poster if player option techCanOverridePoster is set (#4921)
The option for the player techCanOverridePoster is introduced in this commit. It allows techs to update the post whenever they like. isPosterFromTech_ is introduced as a private player field in order to track when a poster was set by a tech. This allows us to clear the poster whenever the tech is disposed of by the player.

Additionally, attempting to set the same poster more than once will have no effect / no changes will be made, since the poster is the same. This was done in order to stop triggering multiple posterchange events when calling player.poster(aPoster) with techCanOverridePoster set to true.

When a tech is disposed and a poster was set by it, unset the poster.

Pass a `canOverridePoster` option to techs to know whether techCanOverridePoster was set.

Fixes #4910.
2018-03-07 14:31:50 -05:00
Brandon Casey
df96a74f6b feat: sourceset event (#4660)
Trigger a sourceset event whenever the source is set in the Html5 tech, including initial source. We override the video element's src and setAttribute methods so that we can trigger the sourceset event when people change the src with both the video element and our API methods.
The event object for sourceset will contain the src string that was provided at the time the sourceset was triggered. This is mostly important if a source is being set while a tech is changing.
A Tech has a featuresSourceset option that it can set to for sourceset handling. It can then call the helper triggerSourceset(src) to trigger the sourceset.
2018-03-07 14:28:37 -05:00
Gary Katsevman
9c4ded8899
fix(events): triggering with an object had incorrect target property on event object (#4993)
Currently, trigger an event with an object rather than a string will have the document as a target on the event object rather than the element.
2018-03-05 16:42:06 -05:00
Gary Katsevman
0ace2a5449
fix: regression for getting a player via the tech's id (#4969)
As part of https://github.com/videojs/video.js/pull/4836, this piece of code was removed because it was thought it was not needed as everything else covers it. Turns out it's needed.

f6eaa5e2ae/src/js/video.js (L103-L107)
2018-02-22 14:22:12 -05:00
Gary Katsevman
29a8ee1d60
fix: cache middleware instances per player (#4939)
Middleware factories currently get run each time a source is set. Because middleware are assocated with a player, the factories should only run once per player.

This PR fixes it so that we associate a middleware instance with a middleware factory per player.
Each time a player is disposed, we will clear the cache of the middleware instances for that player.

Fixes #4677.
2018-02-12 17:30:27 -05:00
Gary Katsevman
7670db63cd
fix(middleware): do a null check in mediator methods (#4913) 2018-01-31 10:46:58 -05:00
Gary Katsevman
9ceb4e4fe0
feat: playerresize event in all cases (#4864)
Use ResizeObserver when available for better and more performant resizing information, otherwise, fall back to a throttled resize event on an iframe that's the size of the player.
Allows a video.js user to disable this by setting resizeManager: false as an option since the component will not be initialized.

Add a debounce util.

This reverts #4800 (e0ed0b5) because we end up getting two playerresize events with the dimension methods now.
2018-01-30 13:26:21 -05:00
Pat O'Neill
6a0057716b feat: Add videojs.getAllPlayers to get an array of players. (#4842) 2018-01-30 11:43:47 -05:00
ldayananda
bf3eb45a37 feat: add mediator middleware type for play() (#4868)
This will allow middleware to interact with calls to play() from the tech. This will require a method of indicating to middleware previously run that a middleware down the chain has terminated or stopped execution.

* Adds middleware mediator method that runs middleware from the player to the tech and a second time back up to the player. This category was created because play is both a setter(changes the playback state) and a getter(gets a native play promise if available). This also has the ability to tell whether a middleware has terminated before reaching the tech.
* Adds a middleware.TERMINATOR sentinel value that is available on the videojs object
* Adds play to the allowedMediators
* Adds paused to the allowedGetters
* Adds a sandbox example of a play mediator middleware
2018-01-30 11:30:42 -05:00
mister-ben
f03ac5e9b5 fix: do not patch canplaytype on android chrome (#4885)
Patching canPlayType on Android shouldn't be necessary on Android Chrome since it reports its ability to player HLS correctly.
2018-01-30 11:20:33 -05:00
Pat O'Neill
a15e616a45 feat: Add getPlayer method to Video.js. (#4836) 2018-01-30 11:19:06 -05:00
Gary Katsevman
dcab42e3d0
chore(package): update dependencies (#4908) 2018-01-30 11:18:04 -05:00
Gary Katsevman
41fd5cb4e6
test: add project and build names to browserstack (#4903) 2018-01-26 12:24:26 -05:00
Pat O'Neill
a6f444443c fix: Fix an issue where hookOnce failed for the 'beforesetup' hook. (#4841) 2018-01-03 16:57:17 -05:00
Garrett Singer
5f89570b99 fix: modify debug log tests to accomodate old IE stringification (#4824) 2017-12-14 18:48:50 -05:00
sivapalan
e0ed0b5cd7 feat: playerresize event on Player dimension API calls (#4800)
Trigger a `playerresize` event when `width()`, `height()`, or `dimensions()` is called.

First part of #4629.
2017-12-14 17:33:29 -05:00
Garrett Singer
ba0f20ec35 feat: add support for debug logging (#4780)
Adds support for `debug` as an available logging method under `videojs.log`
Changes the default log level from `all` to `info`
2017-12-14 17:31:51 -05:00
Gary Katsevman
6fe7a9a3dd
fix: force autoplay in Chrome (#4804)
Chrome has started pausing autoplaying video elements when they are
moved in the DOM. Here we need to make sure that if the video started
autoplaying, after we move the element in the DOM we call play again.

Fixes #4720.
2017-12-14 11:24:48 -05:00
Brandon Casey
bbea5cc7cb fix: only print element not in DOM warning on player creation (#4755) 2017-11-16 18:12:37 -05:00
Brandon Casey
06641e8694 test: update tests to use qunit 2 assert format (#4753) 2017-11-16 18:12:09 -05:00
Brandon Casey
3aae4b2336 test: clean up test warnings (#4752) 2017-11-16 18:11:55 -05:00
Pat O'Neill
26b0d2cadd fix(Player#play): Wait for loadstart in play() when changing sources instead of just ready. (#4743)
The core goal here is to make sure the following works in light of some middleware process that makes setting the source more async than next tick:

```js
player.src('...');
player.ready(() => player.play());
```

In fact, given this change, we should even be able to do:

```js
player.src('...');
player.play();
```

Unlike #4665, which would have clarified/changed the meaning of "ready", it remains a reflection of the tech's state and we make better use of the ability to queue things on that state and on the middleware `setSource` process.
2017-11-16 16:41:01 -05:00
Gary Katsevman
2da7af1137
perf: null out els on dispose to minimize detached els (#4745)
A we retained a lot of references to DOM elements in various components. Here we clear it up. Also, make sure that we remove unused listeners as they can retain objects as well.
Update evented mixin to null out the eventBusEl_ after the component is disposed.
Add a feature for components, to tell it not to auto-initialize the evented mixin.
Re-enable the tests that were removed in #4640.
2017-11-16 11:19:47 -05:00
Gary Katsevman
d8aadd5bee
feat: allow embeds via <video-js> element (#4640)
Add the ability to initialize Video.js with an element named video-js. This is because sometimes, seeing the native element is undesirable, plus, it's cool to have our own element.
Can be used just like the video embed.
IE9 is supported but only with dynamic sources as the source element can only be used inside of the video element.
2017-11-13 14:20:05 -05:00
Brandon Casey
acf4153963 feat: add a version method to all advanced plugin instances (#4714) 2017-11-07 15:48:24 -05:00
Ilya Piatrenka
c213737f7a test: warning, if the element is not in the DOM (#4723)
Add test to #4698
2017-11-07 15:44:16 -05:00
Joe Forbes
9acbcd8410 fix: player.src() should return empty string if no source is set (#4711)
player.src() returns undefined for a new player but it should return '' like player.currentSrc() does and as the video element itself does.
2017-11-01 11:12:48 -04:00
Gary Katsevman
45a6b3010d
test: fix modal dialog test for showing controls (#4707)
Also, add a test that verifies the behavior for the PR (#4690).

Fixes #4706.
2017-10-31 11:35:01 -04:00
Pat O'Neill
85fe685696 feat: Add videojs.hookOnce method to allow single-run hooks. (#4672) 2017-10-30 17:56:21 -04:00
Brandon Casey
983a573928 test: get rid of redundant test logging (#4682) 2017-10-23 18:26:18 +00:00
Alex Barstow
1e80e59614 test: add unit tests for player.duration() (#4459)
Unit tests for https://github.com/videojs/video.js/pull/4443
2017-07-14 14:20:37 -04:00
Gary Katsevman
687aae50ff chore: switch to using chrome for testing PRs on travis (#4462) 2017-07-05 09:44:43 +10:00
Gary Katsevman
82c8b80548 fix: auto-removal remote text tracks being removed when not supposed to (#4450)
We added a feature so that remote text tracks can auto-removed when a source changes. However, in 6.x we changed the source behavior to be asynchronous meaning that some text tracks were accidentally being removed when they weren't supposed to be.
For example:
```js
var player = videojs('my-player');
player.src({src: 'video.mp4', type: 'video/mp4'});
 // set second arg to false so that they get auto-removed on source change
player.addRemoteTextTrack({kind: 'captions', src: 'text.vtt', srclang: 'en'}, false);
```
Now when the player loads, this captions track is actually missing because it was removed.

Instead of adding auto-removal tracks immediately to the list, wait until we've selected a source before adding them in.


Fixes #4403 and #4315.
2017-06-28 16:38:29 +10:00