-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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: Add methods to add and remove <source> elements #8886
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. |
removeSourceElement(srcUrl) { | ||
if (!srcUrl) { | ||
log.error('Source URL is required to remove the source element.'); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this function returns a boolean but addSourceElement
does not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
ff4cda9
to
b81d154
Compare
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:api
to error