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

598 Commits

Author SHA1 Message Date
Gary Katsevman
c1cbce386d
fix(tracks): don't select tracks based on user pref if no langauge is set (#5556)
When preselecting a new track based on user preference, make sure that the language is actually set and that the track we're testing is either a captions or a subtitles track.

Fixes #5553
2018-11-06 16:36:15 -05:00
Grzegorz Blaszczyk
f1784587f6 feat: add 'replay' option to the PlayToggle component. (#5531)
The `PlayToggle` has one option `replay` which can show or hide replay icon. This can be set by passing `{replay: false}` as the default behavior replay icon is shown after video end playback.

Example of how to hide a replay icon
 ```js
let player = videojs('myplayer', {
  controlBar: {
    playToggle: {
      replay: false
    }
  }
});
```

Fixes #4802
2018-11-02 16:47:52 -04:00
Garrett Singer
0060747d5a fix: Don't remove vjs-waiting until time changes (#5533)
Sometimes the vjs-waiting class is removed prematurely after the player gets into a waiting state. This removes the graphic waiting spinner while the player is still waiting. Instead, we should make sure that the currentTime has updated before removing the spinner.
2018-11-02 16:43:32 -04:00
Brandon Casey
2e704509c9 chore: switch to videojs-generate-karma-config (#5528) 2018-10-31 11:01:30 -04:00
Brandon Casey
8bf42064f3 fix: blob urls being ignored as valid sources (#5525)
Instead of checking for blob urls in the generic updateSourceCaches method, check for blob urls inside of handleTechSourceset before updating the source cache.

Fixes #5504.
2018-10-25 18:56:56 -04:00
Brandon Casey
5f73f76a11 chore: move scss grunt tasks to npm scripts (#5520) 2018-10-25 15:45:08 -04:00
Gary Katsevman
313036e132
chore(babel): Upgrade to Babel 7 (#5498)
Use npx babel-upgrade --write --install to initiate the upgrade. Then update grunt and rollup.

Decreases minified, gzipped filesize by about 1KB. Decreases build times by a few minutes.
2018-10-12 15:54:51 -04:00
Pat O'Neill
6df3ac78d4 feat: Add responsive option, which enables breakpoints support. (#5496)
Follow-up for #5471

This makes the breakpoints option and `breakpoints()` method clearer and introduces the responsive option and `responsive()` method, which will turn on the breakpoints.

The return value of `currentBreakpoint()` was simplified to only ever return a string (empty if none).

Also, added convenience methods: `responsive()`, `getBreakpointClass()`, and `currentBreakpointClass()`.
2018-10-11 17:03:33 -04:00
Pat O'Neill
51bd49f4bc feat: Add breakpoints option to support toggling classes based on player width. (#5471)
This adds a breakpoints option. By default, this option is false meaning this is an opt-in feature.

When passing true, it will use a default set of breakpoints. Or custom breakpoints can be passed if users do not like our breakpoints (or previously-existing style decisions).

- Add breakpoints option.
- Adds some new (currently unused) classes: vjs-layout-medium, vjs-layout-large, vjs-layout-x-large, and vjs-layout-huge.
- Add updateCurrentBreakpoint and currentBreakpoint methods to the player.
- Update css/components/_adaptive.scss
- Add sandbox/responsive.html.example

Closes videojs/video.js#4371
2018-10-10 15:30:20 -04:00
Gary Katsevman
ca09968b7d
feat(fill): make vjs-fill a player mode (#5478)
Like fluid mode, you can enable it with the class or by calling the fill
method. Calling fill() will turn off fluid mode and calling fluid() will
turn off fill mode.

Fluid mode takes precedence over fill mode.
2018-10-05 14:28:09 -04:00
Gary Katsevman
966eb56c02
feat: createLogger for easier logging in individual modules (#5418)
Create a new createLogger module for better debugging. Each logger has its own log level and its own createLogger that will nest logs underneath them. `player.log` is also included, which logs the player id as part of the log statement. The history API also got a filter method.

For example:
```js
var log = videojs.log.createLogger('foo');
log('hello');
// > VIDEOJS: foo: hello
```
2018-09-28 16:52:58 -04:00
Pat O'Neill
ebf8d6671c docs: Update JSDoc comments, so core API docs for the videojs function are accurate. (#5385) 2018-09-28 16:21:18 -04:00
Gary Katsevman
6bff3ce779
fix(vjsstandard): update to 8.0.2 and fixup linting (#5413) 2018-09-28 14:58:15 -04:00
Gary Katsevman
15df4e16b4
fix(text-tracks): cuechange handler not triggering correctly (#5446)
We were only triggering cuechange events if a metadata track started out as not disabled or only when setting the mode to 'showing'

Fixes #5308
2018-09-25 14:42:58 -04:00
Brandon Casey
58405fdf78 fix: always return a promise from play, if supported (#5227)
If Promise is available or if Promise is polyfilled, then we'll return a new Promise from `play()` that will get fulfilled with the value returned from the `play()` method. This means that on IE11, this promise will get resolved when we call `play()` even if play doesn't succeed. We will have a follow-on PR to polyfill this behavior and resolve or reject the promise for browsers like IE11 that don't return a promise from `play()`.
2018-08-10 16:27:05 -04:00
Gary Katsevman
8c92cbfb3e
feat: async change events in TextTrackList with EventTarget#queueTrigger (#5332)
Trigger the change event on the next tick. This means that multiple changes to a track's mode will only result in a single change event on its associated TextTrackList rather than 3 events as it may be currently.

Fixes #5159
2018-07-25 17:33:30 -04:00
Gary Katsevman
781a6d87c6
feat(middleware): make setSource be optional (#5295)
setSource is useful if you care to be fiddling with the source or doing some work depending on what source is set. However, sometimes, you don't need a setSource and want the middleware to always be selected.
Now, if setSource is missing, it will implicitly be included in the middleware chain.
2018-07-06 14:16:16 -04:00
Gary Katsevman
361dc76e12
revert: "fix: Allow evented objects, such as components and plugins, to listen to the window object in addition to DOM objects. (#5255)" (#5301)
This reverts commit 7fd29b4f18.

With this change, playing back HLS content via VHS caused an infinite
event loop to be printed out. See issue #5281
2018-07-06 13:51:22 -04:00
Gary Katsevman
d7f27b7112
perf: setTimeout and requestAnimationFrame memory leak (#5294)
Our setTimeout and requestAnimationFrame methods added dispose handlers so that they get cancelled if the component is disposed before they get a chance to run. However, we were only clearing out these dispose handlers if we cleared the timeout or the rAF manually. Instead make sure that we remove the dispose handler when it is no longer needed.

Fixes #5199.
2018-07-05 16:29:03 -04:00
Darius Oleskevicius
237041698c feat: show mute toggle button if the tech supports muting volume (#5052)
Currently, VideoJS combines volume control with muted support, and these actions aren't actually the same. Muting/unmuting volume work independently from the volume control. For example, iOS doesn't support controlling volume programmatically but allows muting/unmuting volume.

This change will display the volume control panel and mute toggle button if the tech supports muting volume. The volume slider will continue to be hidden if the platform doesn't allow programmatically control volume. If neither muting nor control volume is supported, volume panel will not be displayed.

Fixes #4478.
2018-06-21 14:33:08 -04:00
Brandon Casey
e8e4fe2745 feat(autoplay): extend autoplay option for greater good (#5209)
This PR extends the `autoplay` to the player with a few options that should hopefully make working with browsers that disable unmuted autoplay by default easier.
The current boolean option will match current behavior and any unknown option will be treated as it does now. The new options are the string values `muted`, `play`, and `any`.

- `muted` will mute the element and call `play()` on `loadstart`,
- `play` will call `play()` on `loadstart()`, this is similar to the `autoplay` attribute
- `any` will call `play()` on `loadstart()` but if it fails it will try muting the video and calling `play()` again.
2018-06-21 14:32:07 -04:00
Phil Richman
e92f177ce2 feat(text-track-display): Extend the constructColor function to handle 6 digit hex codes (#5238)
When providing the TextTrackDisplay component with track settings overrides, currently colour codes with only three digits are supported. This updates it so that 6 digit hex codes are also accepted.
2018-06-21 14:20:12 -04:00
Pat O'Neill
7fd29b4f18 fix: Allow evented objects, such as components and plugins, to listen to the window object in addition to DOM objects. (#5255)
the bug is that objects using the new-ish evented mixin cannot listen to the window object, preventing things like:

```
component.on(window, 'scroll', throttledListener);
```

This fixes that so anything that's a native EventTarget works.
2018-06-20 17:05:33 -04:00
Chuck Wilson
9504a93643 fix: make sure source options are passed through (#5241)
The changes to source caching in #5156 introduced a regression where the source options were no longer available to plugins. This PR makes sure the cached source object retains any source options passed along.
2018-06-11 13:47:36 -04:00
Gary Katsevman
954f3d979f
fix(player): video-js embed missing video-js class (#5194)
When having a video-js embed with a class attribute, as part of the
changes to remove old IE support (#5041), we overwrote our addition of
the video-js class when it was missing. Instead, we want to make sure
that we don't override the class names again since they are already set
up correctly.

Fixes videojs/http-streaming#100
2018-05-22 21:44:35 -04:00
Brandon Casey
22fd327076
tests: do not throw on tech/player dispose (#5179) 2018-05-16 12:02:41 -04:00
Owen Edwards
1c74e4fa0b fix: Reduce the multiple-announcement by screen readers of the new name of a button when its text label changes. (#5158)
Move the aria-live attribute to the control text element within buttons, rather than on the whole button, so it is not affected by the change of the title attribute, only by the change of the control text.

It seems like having aria-live on the button itself means that JAWS and NVDA announce the button both when the button text changes and when the title attribute changes. NVDA speaks the new label more times because it announces the button text as the label and the title as the description, so it says, for example, "pause button pause". JAWS doesn't appear to do this, so it doesn't repeat it as many times.

Partially addresses #5023
2018-05-11 14:31:28 -04:00
Brandon Casey
c6617b24f7
feat: copy properties from <video-js> to the media el (#5039) 2018-05-09 15:55:29 -04:00
Brandon Casey
6147e5f7aa
fix: sourceset and browser behavior inconsistencies (#5054)
* We now trigger `sourceset` any time a `<source>` element is appended to a mediaEl with no source.
  * `load` should always fire a `sourceset`
  * `sourceset` should always be the absolute url.
2018-05-09 15:51:47 -04:00
Brandon Casey
ba2ae7868b
feat: update the players source cache on sourceset (#5040) 2018-05-08 17:46:46 -04:00
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