-
Notifications
You must be signed in to change notification settings - Fork 91
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/default duration #779
Changes from 3 commits
bb6c4d5
24ed9b5
982bd04
feddaf9
fe30917
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,10 +150,18 @@ | |
MEDIA_DURATION: { | ||
get: function (controller) { | ||
const { media } = controller; | ||
const defaultDuration = controller.hasAttribute('defaultduration') | ||
? +controller.getAttribute('defaultduration') | ||
: NaN; | ||
|
||
// TODO: What if duration is infinity/live? (heff) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, ha. Still a future us problem? Or can we remove this note? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't wanna be presumptuous, but we can probably remove it. We expect to strip live infinity in our architecture rn and don't have a story for live + our components that (typically) expect a (finite) duration. I'll drop it before merging. |
||
if (!media || !Number.isFinite(media.duration)) { | ||
return NaN; | ||
return defaultDuration; | ||
} | ||
|
||
// Apply defaultDuration if it's set and the media is not yet ready | ||
if (!(media.readyState || Number.isNaN(defaultDuration))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not rely on media.duration? media.duration >= 0 and not NaN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting thought! I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right |
||
return defaultDuration; | ||
} | ||
|
||
return media.duration; | ||
|
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.
NOTE: we can revert this if preferred, though I think it might be a good example for
advanced
.