Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(player): simplifies audio track handling #40

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

amtins
Copy link
Member

@amtins amtins commented Oct 19, 2023

Description

Resolves #38 by adding the audioTrack function to simplify audio track retrieval and selection. This function allows to:

  • retrieve the currently active audio track
  • activate an audio track based on language and kind properties

Also, when selecting an audio track, if the kind property is not satisfied, the first audio track satisfying the language condition will be returned, or undefined if no condition is satisfied.

// Get the current audio track
player.audioTrack();

// Activate an audio track
player.audioTrack({language:'en', kind:'alternative'})

Changes made

  • redefine default video.js player component
  • add audioTrack function
  • add a typedefs file to keep all types
  • add trackSelector type representing the track to be selected
  • add test coverage

@github-actions
Copy link

github-actions bot commented Oct 19, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
98.45% (+0.04% 🔼)
445/452
🟢 Branches
93.21% (+0.19% 🔼)
206/221
🟢 Functions 100% 130/130
🟢 Lines
99.31% (+0.01% 🔼)
433/436
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / player.js
100% 100% 100% 100%

Test suite run success

131 tests passing in 9 suites.

Report generated by 🧪jest coverage report action from b01c855

Resolves #38 by adding the `audioTrack` function to simplify
audio track retrieval and selection. This function allows to:

- retrieve the currently active audio track
- activate an audio track based on `language` and `kind` properties

Also, when selecting an audio track, if the `kind` property is not satisfied,
the first audio track satisfying the `language` condition will be returned,
or `undefined` if no condition is satisfied.

```javascript
// Get the current audio track
player.audioTrack();

// Activate an audio track
player.audioTrack({language:'en', kind:'alternative'})
```

- redefine default video.js `player` component
- add `audioTrack` function
- add a `typedefs` file to keep all types
- add `trackSelector` type representing the track to be selected
- add test coverage
@amtins amtins force-pushed the feat/38-simplified-api-for-audio-track-selection branch from 5c39d4f to b01c855 Compare October 19, 2023 15:11
@amtins
Copy link
Member Author

amtins commented Oct 20, 2023

@defagos thanks for the review 👍🏽

@amtins amtins merged commit ef81d39 into main Oct 20, 2023
@amtins amtins deleted the feat/38-simplified-api-for-audio-track-selection branch October 30, 2023 14:59
@amtins amtins added the enhancement New feature or request label Nov 8, 2023
Copy link

github-actions bot commented Feb 9, 2024

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released on @main
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplified API for audio track selection
2 participants