feat: Add methods to add and remove <source> elements#8886
Merged
alex-barstow merged 5 commits intomainfrom Oct 9, 2024
Merged
feat: Add methods to add and remove <source> elements#8886alex-barstow merged 5 commits intomainfrom
alex-barstow merged 5 commits intomainfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8886 +/- ##
==========================================
+ Coverage 83.21% 83.25% +0.03%
==========================================
Files 120 120
Lines 8068 8097 +29
Branches 1938 1944 +6
==========================================
+ Hits 6714 6741 +27
- Misses 1354 1356 +2 ☔ View full report in Codecov by Sentry. |
Merged
6 tasks
wseymour15
reviewed
Oct 8, 2024
| removeSourceElement(srcUrl) { | ||
| if (!srcUrl) { | ||
| log.error('Source URL is required to remove the source element.'); | ||
| return false; |
Contributor
There was a problem hiding this comment.
Is there a reason this function returns a boolean but addSourceElement does not?
Contributor
Author
There was a problem hiding this comment.
Good call, both probably should. The reason I didn't have addSourceElement() return a boolean is because originally I hadn't added that early return so a source element would always be added.
ff4cda9 to
b81d154
Compare
wseymour15
approved these changes
Oct 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
It is useful to have methods for appending and removing
<source>elements to the<video>element, as they are sometimes required to enable certain playback features, for example, using Airplay with MSE.Specific Changes proposed
Add new methods--
addSourceElement()andremoveSourceElement()to the player and tech. The former will take a source object and create and append a new<source>element to the<video>element, and the latter will take a source url and remove any<source>element with a matchingsrc.Requirements Checklist
npm run docs:apito error