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

720 Commits

Author SHA1 Message Date
mister-ben
73db132d86
fix: ensure spatial navigation starts without error without an ErrorD… (#8830)
…isplay component

## Description
By default a Video.js player has an ErrorDisplay, but in the event it is
created without one, an error will be thrown when starting spatial
navigation.

## Specific Changes proposed
Only add an event listener to `player.errorDisplay` if it exists.

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [x] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [x] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [x] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-08-22 17:07:41 +02:00
mister-ben
e715145d86
fix: Change requestNamedAnimationFrame to apply last change per frame instead of first (#8799)
## Description
The current implementation of `requestNamedAnimationFrame` prevents
multiple updates on a frame but by disregarding all but the first
request per frame. This throttling behaviour is apparent when playing a
very short video - if a `timeupdate` occurs just before the `ended`
event, the progress bar position on the `timeupdate` is set at say 98%
and 100% from the `ended` is discarded. Although #8633 removed the
throttle from the `ended` handler itself, the throttle and non-throttled
update can still both execute between frames.

## Specific Changes proposed
Changes the implementation to apply only the last callback instead. If
any exist they will be cancelled. There will still be only one update,
but now it's the last.
Updates tests to reflect the changed behaviour. 
Fixes #8782

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [x] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [x] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [x] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-08-13 10:54:53 +02:00
mister-ben
3380d33d6f
chore: Remove safe-json-parse (#8790)
## Description
Removes an old unmaintained dependency that isn't needed any more.

## Specific Changes proposed
Replace safe-json-parse with `JSON.parse`

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [ ] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [x] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [x] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-08-11 08:21:10 +02:00
Carlos Javier Villaseñor Castillo
daf40bd4aa
fix(spatial-navigation): focus lost in error modal (#8817)
## Description
The spatial-navigation is unable to focus certain elements of the error
modal when this appears, this PR will fix that

## Specific Changes proposed
Allow the spatial-navigation to focus certain non-component elements in
the error modal

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [ ] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [ ] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [ ] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [ ] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-07-29 12:11:58 -06:00
Carlos Javier Villaseñor Castillo
76e99b7bea
fix(spatial-navigation): keep navigation going when player has an error (#8805)
## Description
The bug:
 Focus is lost when playback error is displayed.

This small PR will update the spatial-navigation logic so when the error
modal is shown the spatial-navigation will try to focus the components
present in the error modal, in most cases this will be the vjs close
button.

## Specific Changes proposed
Keep navigation working when player shows the error modal by focusing a
component in that modal.

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [ ] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [ ] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [ ] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [ ] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-07-22 16:43:20 -06:00
mister-ben
1afe5049e6
feat: Adds a transient button component (#8629)
## Description
Adds a `TransientButton` component for the types of button that are
shown on top of the video briefly during playback and reappear when
there is user activity. e.g. Unmute buttons, skip intro. It aims is to
be a generic button type to be extended. Some basic styles are provided
but kept light to not complicate customisation.
It's important to insert a transient button before the control bar for
the tab order to make sense.

_Optionally_ takes focus when shown.

## Specific Changes proposed
Adds `TransientButton` component.

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [x] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [x] Example:
https://deploy-preview-8629--videojs-preview.netlify.app/sandbox/transient-button.html
- [x] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [x] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-07-06 07:40:31 +01:00
mister-ben
a10d25861d
fix: removes duplicate id in text track settings (#8755)
## Description
Prevents a duplicate id in text track settings.
Fixes #8754

## Specific Changes proposed
The text edge settings were erroneously duplicating the id generated for
the background colour. Changes to a unique name.
Adds a general test for duplicate ids.

## Requirements Checklist
- [x] Feature implemented / Bug fixed
- [ ] If necessary, more likely in a feature request than a bug fix
- [x] Change has been verified in an actual browser (Chrome, Firefox,
IE)
  - [x] Unit Tests updated or fixed
  - [ ] Docs/guides updated
- [ ] Example created ([starter template on
JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0))
- [x] Has no DOM changes which impact accessiblilty or trigger warnings
(e.g. Chrome issues tab)
  - [x] Has no changes to JSDoc which cause `npm run docs:api` to error
- [ ] Reviewed by Two Core Contributors
2024-06-01 23:11:52 +02:00
Pat O'Neill
91e5e2dc8d
add browser.IS_CHROMECAST_RECEIVER and class name for CSS targeting on a Chromecast receiver where Video.js is used (#8703) 2024-05-30 12:16:43 -07:00
mister-ben
35de64ceb0
refactor: Replace keycode dependency with event.key (#8735)
refactor: Replace keycode dependency with event.key
2024-05-23 18:50:23 +02:00
mister-ben
ad3be357d5
fix: Ensure aria-labelledby values in track settings are valid (#8711) 2024-05-06 09:58:47 -07:00
weiz18
9946a197eb
fix(dom): handle slotted parent transform position (#8158)
* fix(dom): handle slotted parent transform position

* fix(test): add test to cover getPointerPosition

* run all tests

---------

Co-authored-by: mister-ben <git@misterben.me>
2024-05-03 14:23:30 +02:00
André M
8050466bcc
fix(player): adapt player height to control bar height in audioOnly mode (#8579)
Adapts the `player.height` to the `controlBar.currentHeight` when the
`audioOnlyMode` is `enabled`. This ensures that the player height and control
bar height are always in sync when the player is resized.

- add `updatePlayerHeightOnAudioOnlyMode_` function that will update the player
height according to the control bar height when the player is resized
- modify `enableAudioOnlyUI_`
  - add a `controlBarHeight` to `audioOnlyCache_` to keep track of the control
  bar height changes when the player is resized
  - add a `playerresize` listener
- modify `disableAudioOnlyUI_` to remove the `playerresize` listener
2024-05-03 14:15:01 +02:00
mister-ben
992af3b3ee
refactor: use URL API (#8716)
* refactor: use URL API

* add relative test

* remove old jsdoc comment

* Corrected test description
2024-05-03 14:06:05 +02:00
Grzegorz Blaszczyk
3e697e942f
fix: progress bar sometimes is not filled on 100% (#8633)
* fix: the seek bar shouldn't throttle the update function on the ended event.

* test: add unit test
2024-05-03 13:57:32 +02:00
mister-ben
cb76a24bd5
fix: Support MacOS trackpad with tap-to-click (#8700) 2024-04-25 18:38:05 +02:00
Carlos Javier Villaseñor Castillo
ec69d5e620
feat(player): Make 'searchForTrackSelect_' private & use 'el' as parameter in function 'getIsFocusable' (#8697) 2024-04-18 12:57:27 -06:00
Borut Zizmond
21b4a5225b
feat: implement spatial navigation (#8570)
* feat(player): add spatialNavigation feature

Adds spatialNavigation feature to enhance user experience

- Implemented spatial navigation in slider component
- Enhanced player functionality for improved navigation

* feat(player): add spatialNavigation class
Adds spatialNavigation class to manage spatial-navigation-polyfill
- Set class SpatialNavigation on its own file
- Imported SpatialNavigation class on component class

* feat(player): update spatialNavigation class
Adds 3 methods to spatialNavigation class to manage spatial-navigation-polyfill
- Added start() to: Start listen of keydown events
- Added stop() to: Stop listen key down events
- Added getComponents() to: Get current focusable components

* feat(player): modify spatialNavigation class & modify component class
Modify spatialNavigation class:
-Remove unrequired version of function ‘getComponents’
Modify component class:
-Add function ‘getIsFocusable’

* Added methods getPositions, handleFocus and handleBLur for spatial navigation needs

* feat(player): modify Component class, BigPlayButton class & ClickableComponent class
Modify Component class:
-Add method getIsAvailableToBeFocused
-Modify method getIsFocusable to only focus on finding focusable candidates
Modify spatialNavigation class:
-Remove unrequired method ‘getIsFocusable’
Modify component class:
-Remove unrequired method ‘getIsFocusable’

* Added import in player.js, Created base methods inside spatial-navigation.js

* feat(player): modify Component class & SpatialNavigation class
Modify Component class:
-Modify method getIsAvailableToBeFocused to be more strict on candidates
Modify spatialNavigation class:
-Modify method getComponents to get all focusable components

* feat(player): modify Component class
Modify Component class:
-Add documentation to ‘isVisible’ function

* added keydown event logic for spatial-navigation

* feat(player): modify SpatialNavigation class
Modify SpatialNavigation class:
-Modify documentation of functions

* feat(player): modify SpatialNavigation class
Modify SpatialNavigation class:
-Add ‘clear’ & ‘remove’ methods

* feat(player): modify SpatialNavigation class
Modify SpatialNavigation class:
-Add documentation of functions

* feat(player): modify SpatialNavigation class
Modify SpatialNavigation class:
-Add function ‘getCurretComponent’‘’

* feat(player): modify SpatialNavigation class
Modify SpatialNavigation class:
-Add documentation for ‘findBestCandidate’ method

* Added logic for moving focus to the best candidate

* Implemented move, findBestCandidate, isInDirection, and calculateDistance methods for spatial navigation logic

* Added a new player option enableKeydownListener, Added gap: 1px to control-bar for spatial-navigation-polyfill needs

* feat(player): modify SpatialNavigation class  & Component class
Modify SpatialNavigation class:
-Add function ‘handlePlayerBlur’
-Add function ‘handlePlayerFocus’
Modify Component class:
-Modify ‘handleBlur’
-Modify ‘handleFocus’

* Removed enableKeydownListener flag, as user should start the SpatialNavigation manually

* Added functionality to track changes in the focusableComponents list (custom event focusableComponentsChanged)

* feat(player): modify SpatialNavigation class, ModalDialog  & Component class
Modify SpatialNavigation class:
-Add ‘lastFocusedComponent’
-Add function ‘refocusComponent’
Modify ModalDialog class:
-Add condition on ‘close’ function
Modify Component class:
-Modify ‘handleBlur’ to store blurred component

* feat(player): modify ModalDialog
Modify ModalDialog:
-Add condition to close Modal on Backspace

* Refactor SpatialNavigation to use player.spatialNavigation

* Added a new custom event endOfFocusableComponents

* Added new styles for focused elements in case spatial navigation is enabled

* feat(player): modify SpatialNavigation class:
-Add condition so getComponents can get as candidates the UI elements from the playlist-ui

* Changed to window.SpatialNabigation to this.player_.spatialNavigation

* feat(player): modify text-track-settings, created test-track-settings-colors.js, text-track-settings-font.js,text-track-fieldset.js & text-track-select.js:
Modify text-track-settings class:
- Add changes so newly created components can work as content of the modal.
- Create new components as a refactor of  the contents of text-track-settings

* changed handleKeyDown inside component.js, getComponents method is now iterating player.children

* feat(player): create TrackSettingsControls Component & Modify TextTrackSettings
Create TrackSettingsControls Component:
-Create Component to show buttons reset & done as components.
Modify TextTrackSettings:
-Add Component TrackSettingsControls in TextTrackSettings

* feat(player): Modify ModalDialog
Modify ModalDialog:
-Add condition for stop propagation of event inside of ModalDialog when spatialNavigation is enabled

* getIsFocusable and getIsAvailableToBeFocused methods are now accepting el as a parameter, added a new methods findSuitableDOMChild and focus for spatialNavigation class

* feat(player): Modify TextTrackSettings:
Modify TextTrackSettings:
-Remove unrequired methods to create DOM elements since now those are created by Components.

* feat(player): Modify CaptionSettingsMenuItem:
Modify CaptionSettingsMenuItem:
-Add condition to focus component of TextTrackSelect when modal is open

* feat(player): Modify TextTrackSelect & TextTrackFieldset:
Modify TextTrackSelect :
Modify TextTrackFieldset:
-Add comments to certain functions to explain the code

* feat(player): Modify TrackSettingsControls:
Modify TrackSettingsControls:
-Remove unrequired comments & add comments to certain functions to explain the code

* feat(player): Modify SpatialNavigation, Component & ModalDialog:
Modify SpatialNavigation:
Modify Component:
Modify ModalDialog:
-Add & update comments of documentation.

* Handle ENTER keydown in Modals when spatial navigation is enabled

* feat(player): Modify ModalDialog, spatialNavigation, TrackSettingsControls, TextTrackFieldset, TextTrackSelect, TrackSettingsColors, TrackSettingsFont:
Modify ModalDialog:
Modify spatialNavigation:
Modify TrackSettingsControls:
Modify TextTrackFieldset:
Modify TextTrackSelect:
Modify TrackSettingsColors:
Modify TrackSettingsFont:
-Add & update comments of documentation.

* Implement additional RCU controls

* feat(player): Modify Component class:
Modify Component :
-Remove unrequired condition inside of handleFocus method.

* feat(player): Modify ModalDialog & CaptionSettingsMenuItem
Modify ModalDialog:
Modify CaptionSettingsMenuItem:
-Modify spatialNavigation condition to be more specific regarding spatialNavigation implementation.

* feat(player): Modify SpatialNavigation class:
Modify SpatialNavigation :
-Fix bug where ‘enter’ press was not working properly on select component inside of the ‘vjs-text-track-settings’ modal.

* feat(player): Modify SpatialNavigation class:
Modify SpatialNavigation :
-Minor improvements on the loops of certain functions to stop when they have found the element they are looking for.
-Implement minor spacing formatting on switch statement.

* Update src/js/component.js

More understandable documentation.

Co-authored-by: Dzianis Dashkevich <98566601+dzianis-dashkevich@users.noreply.github.com>

* Update src/js/component.js

More understandable documentation.

Co-authored-by: Dzianis Dashkevich <98566601+dzianis-dashkevich@users.noreply.github.com>

* feat(player): Modify SpatialNavigation & Component class:
Modify Component class :
Modify SpatialNavigation class :
-Modify ‘getIsFocusable’ function to use ‘this.el_’ instead of ‘el’ parameter

* feat(player): Modify SpatialNavigation class:
Modify SpatialNavigation class :
-Refactor onKeyDown function to use static data & return when pause is true.

* feat(player): Modify SpatialNavigation class:
Modify SpatialNavigation class :
-Refactor to use ‘.el()’ instead of ‘.el_’

* Update src/js/spatial-navigation.js

Co-authored-by: Walter Seymour <walterseymour15@gmail.com>

* feat(player): Modify ModalDialog class & MenuItem class:
Modify ModalDialog class :
Modify MenuItem class :
-Correct typo of ‘isSpatialNavlistening’ to  ‘isSpatialNavListening’.

* removed unused property, remove this.focus, which was added for testing purposes

* Changed parameters to private, removed redundant code, removed initialFocusedComponent parameter, change STEP_SECONDS to static

* feat(player): solve remaining  conflict:
Modify Spatial Navigation class :
- Solve conflict

* feat(player): Rename TrackSettingsColors & TrackSettingsFont

* feat(player): Remove unrequired functions calls from components TextTrackSettingsColors & TextTrackSettingsFont.

* feat(player):  Update spatial-navigation.js's keypress return keyword.

* bind focus and blur just if spatial navigation is enabled, add 1px gap if spatial navigation is enabled

* feat(player): Modify calls on 'isListening' & 'isPaused' for ModalDialog & TextTrackMenuItem

* feat(player): remove unrequired object on component 'TrackSettingsControls'

* Removed 1px gap

* feat(player): Rename function ‘getComponents’ to ‘updateFocusableComponents’

* Changed SpatialNavigation class to extend EventTarget, removed redundant methods for events

* fix(player): fix call of 'getIsAvailableToBeFocused' that was throwing an error.

* removed Static maps for key presses and extended keycode with the missing keys

* refactor(player): Modify functions of 'getIsDisabled', 'getIsExpresslyInert' & 'getIsFocusable' to be more in pair when stablished code of the player.

* Conditional assignment for keycode.codes.back based on platform, changed Backspace to Back key for Modal closing

* Extend the  object for reverse lookup, prenet Up/down keys to open a menu if spatial navigation is anabled

* refactor(player): Refactor 'SpatialNavKeycodes' file to not patch 'keycode' dependency

* fix(pllayer): fix issue related to 'back' not  being used properly in function 'isEventKey'

* feat(player): Rename imports  of 'spatial-navigation-keycode' to have their extension

* feat(player): Add example of use of 'Client app uses a global spatial-navigation solution'

* feat(player): rename 'spatial-navigation-keycode.js' filename

* Fix on src chnage issue, ESC button closing modal, expand vjs-modal-dialog

* change file name and object name

* fix: Update ids of labels to use 'guid' so unit test works properly

* fix: update localized text in text-track-settings-font & text-track-settings

* Mark some methods as private

* fix: modify content of modal 'text-track-settings' to change language properly

* fix: add missing '.' in jsdoc of text-track components

* feature: add unit test for 'text-track-select' component

* Add test for Spatial Navigation

* test(player): Add minor test related to 'handleBlur' & 'handleFocus'

* feat(player): Remove unrequired files from 'react-video-nav-app'

* test(player): Add small test to check if 'getPositions' returns required properties

* test(player): add test to verify 'getPositions()' properties are not empty

* Add missing tests for performMediaAction_ and move

* test(player): add test to for 'component.js' related to 'handleBlur'

* test(player): add minor test in component related to test keypress propagation event

* test(player): add test for component related to 'getIsAvailableToBeFocused' function

* test(player): add test for Modal Dialog related to call function of spatial navigation

* test(player): add tests  for 'spatial-navigation-key-codes'

* test(player): add tests for keycodes related to 'should return event name if keyCode is not available'

* test(player): add minor test for case when not required parametters are passed

* test(player): add test for 'caption-settings-menu-item'

* feat(player): remove 'react-video-nav-app'

* Move handleFocus and handleBlur from components.js to spatial-navigation.js

* refactor(player): refactor 'searchForTrackSelect' to be handled in the spatial navigation

* remove unrequired code in function 'searchForTrackSelect'

* update documentation comment to be in pair to its current use

* remove spatial navigation keydown from modal dialog and move it to spatial navigation class, modify the modal-dialog test accordingly

* remove useless tests

* Remove caption-settings-menu-item.test.js

* Add minor test to 'searchForTrackSelect' in spatial-navigation.test.js

* Add unit test for back key and listening to events

---------

Co-authored-by: CarlosVillasenor <carlosdeveloper9@gmail.com>
Co-authored-by: Dzianis Dashkevich <98566601+dzianis-dashkevich@users.noreply.github.com>
Co-authored-by: Walter Seymour <walterseymour15@gmail.com>
Co-authored-by: Carlos Villasenor Castillo <cvillasenor@Carloss-MacBook-Pro.local>
2024-04-17 19:34:52 -06:00
Pat O'Neill
8e5870f984
feat: add browser.IS_SMART_TV and class names for CSS targeting devices (#8676) 2024-04-10 10:07:31 -04:00
Harisha Rajam Swaminathan
6eb0230078
fix: error-display (#8529) 2024-01-30 11:32:58 -05:00
Walter Seymour
43941a801f
feat: improved error interface (#8564) 2024-01-25 08:57:16 -06:00
mister-ben
46c9907a9b
fix: Fixes form markup in text track settings (#8557) 2024-01-16 17:43:39 +01:00
Peter Petraník
abdfaacd90
feat: expose version from player.version() (#8543)
Add a `Player#version()` method which returns an object with the Video.js version under the `video.js` property name, to match the package name.

This could then be extended to support adding plugin, tech, and source handler versions as part of the version call.

Fixes #8538
2024-01-04 09:35:23 -05:00
André
608a585dcb
feat: Seek bar smooth seeking (#8287)
* refactor(player): decrease the indentation level in the currentTime method

* fix(player): cache_.currentTime is not updated when the current time is set

Updating cache_.currentTime as soon as the currentTime is set avoids having to wait for the timeupdate event, which results in:

- making cache_.currentTime more reliable
- updating the progress bar on mouse up after dragging when the media is paused.

See also: #6232, #6234, #6370, #6372

* feat: add an option to handle smooth seeking

Adds a player option called enableSmoothSeeking, which is false by default,
to provide a smoother seeking experience on mobile and desktop devices.

Usage:
```javascript
// Enables the smooth seeking
const player = videojs('player', {enableSmoothSeeking: true});

// Disable the smooth seeking
player.options({enableSmoothSeeking: false});
```

- **player.js** add an `option` called `enableSmoothSeeking`
- **time-display.js** add a listener to the `seeking` event if `enableSmoothSeeking` is `true` allowing to update the `CurrentTimeDisplay` and `RemainingTimeDisplay` in real time
- **seek-bar.js** `update` the seek bar on `mousemove` event  if `enableSmoothSeeking` is `true`
- add test cases
2024-01-02 13:11:55 -05:00
André
849098f6c0
fix(player): reset CSS classes at player.reset (#8487)
Allows CSS classes to be reset when `player.reset` is called,
so that the player is close to its initial state.

- remove `vjs-playing`
- add `vjs-paused`
2023-12-04 14:18:11 -05:00
André
161a09cae6
fix(title-bar): component remains displayed after player reset (#8481)
When `player.reset` is called the `titleBar` component is not reset.

- Sets the properties `title` and `description` to `undefined` when `player.titleBar.update` is called so that the component is properly reset.
2023-11-29 10:36:56 +01:00
André
7972c23a55
fix(error-display): component remains displayed after player reset (#8482)
When `player.reset` is called, the `errorDisplay` component is not reset, and neither is `player.error`.

- Sets `player.error` to `null`, so that the `player.errorDisplay` and `player.error` are correctly reset.
- Adds an `error` function to the `testPlayer` stub to prevent tests from failing.
2023-11-28 23:38:41 +01:00
André
78310464d5
fix(error-display): update display on consecutive errors (#8485)
When consecutive errors occur, the `ErrorDisplay` component is not updated with the new error message.
This results in an inconsistent state between the `player.error` and `player.errorDisplay.contentEl().textContent`.

|                         | player.error() | player.errorDisplay.content() | player.errorDisplay.contentEl().textContent |
| ----------------------- | -------------- | ----------------------------- | ------------------------------------------- |
| player.error('Error 1') | Error 1 ✔️      | Error 1 ✔️                     | Error 1 ✔️                                   |
| player.error('Error 2') | Error 2 ✔️      | Error 2 ✔️                     | Error 1                                   |

An example of a use case where updating the error message is useful is :
- user tries to play media 1 but the media doestn't exist
- user tries to play media 2 but the media is not compatible

- call the `close` function before each call to the `open` function.
  - if errorDisplay is not **open**, the `close` function does nothing
  - if errorDisplay is **open**, the `close` function executes and triggers the close events, then the open function executes and triggers the open events, ensuring that the content is updated.
2023-11-28 23:11:15 +01:00
André
68f1429d9b
fix(error): chromium reset mediaError when the poster is invalid (#8410)
When both the media URL and the poster return a response other than 200.
The media error is overwritten by an empty error, leaving the player in an inconsistent state.

- add a condition to `handleTechError_` to ensure that the `error` is truthy
- add a test case

Fixes #8409
2023-09-27 10:18:58 +02:00
Dzianis Dashkevich
cf681e0e76
feat: enhanced logger (#8444)
* Added the createNewLogger method, to create a logger without a naming chain.

* Added optional custom delimiter and custom styles.

* Several improvements in jsDoc for proper types(d.ts) generation.

---------

Co-authored-by: Dzianis Dashkevich <ddashkevich@brightcove.com>
2023-09-25 12:50:01 -04:00
mister-ben
6fc1fd4aaf
fix(tests): Fixes for old Safari (#8368) 2023-07-21 19:12:48 +02:00
Walter Seymour
da15810355
fix: Check for VTTCue (#8370) 2023-07-20 11:38:15 -05:00
mister-ben
452a918a42
fix(tests): Skip a test on old Safari (#8356) 2023-07-19 09:10:07 +02:00
mister-ben
c66bf4023f
fix: make compatible with chrome 53 (#8354) 2023-07-12 19:43:17 +02:00
François Beaufort
8dd98f602b
fix: Don't use copyStyleSheets with documentPIP (#8314)
* Don't use copyStyleSheets

* Move to dom.js

* Add tests

* Address feedback
2023-07-07 15:56:54 +02:00
François Beaufort
146008f610
Use pagehide instead of unload for PiP (#8321) 2023-07-04 13:43:09 +02:00
Walter Seymour
6fc0dc783a
feat: Add useSVGIcons option (#8260) 2023-06-12 13:31:06 -05:00
BrainCrumbz
dc1e2bb42a
fix(shadow-dom): prevent warning 'element supplied is not included' (#8192)
Co-authored-by: Giuseppe Piscopo <g.piscopo@braincrumbz.com>
2023-06-06 17:24:30 -04:00
André
b782cb09f4
fix(player): cache_.currentTime is not updated when the current time is set (#8285)
Updating cache_.currentTime as soon as the currentTime is set avoids having to wait for the timeupdate event, which results in:

- making cache_.currentTime more reliable
- updating the progress bar on mouse up after dragging when the media is paused.

See also: #6232, #6234, #6370, #6372
2023-06-01 08:50:29 -04:00
mister-ben
3af36383ca
fix(jsdoc): corrections to jsdoc (#8277) 2023-05-31 11:12:57 -04:00
André
d524e5755d
fix(picture-in-picture-control): hide the component in non-compatible browsers (#7899) 2023-05-31 10:54:51 -04:00
André
35fad1d454
fix(player): load method fails to reset the media element to its initial state when the VHS is used (#8274) 2023-05-31 10:41:44 -04:00
André
07effdf244
fix(skip-forward): error when clicking after player reset (#8258) 2023-05-31 10:30:49 -04:00
André
e73e05db8f
fix(seek-bar): error when scrubbing after player reset (#8257) 2023-05-31 10:30:13 -04:00
André
5151bc5970
fix(player): techGet is undefined (#8256)
Fixes #8255
2023-05-31 10:29:35 -04:00
André
1a1adf3275
fix(player): address loss of crossOrigin value when loadMedia is called (#8085) 2023-05-31 10:25:34 -04:00
André
f1558c660b
fix(videojs): missing return in registerComponent (#8247) 2023-05-12 12:23:27 -04:00
Dzianis Dashkevich
866ef24b79
fix: Replace Object.values with ponyfill (#8267)
Unpin Firefox in BrowserStack tests, which fixes test failures as well.

Fixes #8266.
2023-05-11 18:57:13 -04:00
Grzegorz Blaszczyk
1491d71b26
feat: text track display overlays a video (#8009) 2023-04-11 21:30:18 +02:00
André
71343d1996
fix: reset progress bar fully when player is reset (#8160) 2023-04-04 16:58:57 -04:00
mister-ben
b489bc5c7d
fix: Ensure additional components update on languagechange (#8175) 2023-04-04 16:54:36 -04:00