Skip to content

Commit

Permalink
fix: rename live edge override attribute to liveedgeoffset. Code clea…
Browse files Browse the repository at this point in the history
…nup per PR feedback.
  • Loading branch information
cjpillsbury committed Feb 22, 2023
1 parent de10896 commit cfb357d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/media-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,7 @@ const Delegates = {
const live = getStreamType(controller) === 'live';
// Can't be playing live if it's not a live stream
if (!live) return false;

const seekable = media.seekable;
// If the slotted media element is live but does not expose a 'seekable' `TimeRanges` object,
// always assume playing live
Expand All @@ -1042,8 +1043,8 @@ const Delegates = {

// Default to 10 seconds
// Assuming seekable range already accounts for appropriate buffer room
const liveEdgeStartOffset = controller.hasAttribute('livethreshold')
? Number(controller.getAttribute('livethreshold'))
const liveEdgeStartOffset = controller.hasAttribute('liveedgeoffset')
? Number(controller.getAttribute('liveedgeoffset'))
: 10;
const liveEdgeStart = seekable.end(seekable.length - 1) - liveEdgeStartOffset
return media.currentTime >= liveEdgeStart;
Expand Down

0 comments on commit cfb357d

Please sign in to comment.