-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: CMCD v2 LTC and MSD keys #7412
Open
JoaquinBCh
wants to merge
13
commits into
shaka-project:main
Choose a base branch
from
qualabs:feature/cmcd-v2-keys
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f805efe
feature: play and playing time obtained for msd key
JoaquinBCh d224c7b
Implement msd CMCDv2 key
sebastianpiq 51b6866
Implement ltc CMCDv2 key
jmt-qualabs e91b872
Add unit tests for CMCDv2 keys
jmt-qualabs be1c4bf
Unit tests fixed
JoaquinBCh 6ae4894
Merge branch 'main' into feature/cmcd-v2-keys
JoaquinBCh 459c766
fix: listenOnce instead of listen for msd calculation
JoaquinBCh 29a7634
constants for version added
JoaquinBCh 123163d
Merge branch 'main' into feature/cmcd-v2-keys
JoaquinBCh 2d840b5
feat: contributors updated
JoaquinBCh f0a5843
fix: getLiveLatency() and add unit tests, enhance CMCD typedefs
JoaquinBCh ccd9d3e
Merge branch 'main' into feature/cmcd-v2-keys
JoaquinBCh 0730e20
fix: linter errors
JoaquinBCh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,7 @@ Peter Nycander <[email protected]> | |
Philo Inc. <*@philo.com> | ||
PikachuEXE <[email protected]> | ||
Prakash <[email protected]> | ||
Qualabs <*@qualabs.com> | ||
Robert Colantuoni <[email protected]> | ||
Robert Galluccio <[email protected]> | ||
Rodolphe Breton <[email protected]> | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,12 +75,14 @@ Jeffrey Swan <[email protected]> | |
Jesper Haug Karsrud <[email protected]> | ||
Jesse Gunsch <[email protected]> | ||
Jimmy Ly <[email protected]> | ||
Joaquin Bartaburu <[email protected]> | ||
Joey Parrish <[email protected]> | ||
Johan Sundström <[email protected]> | ||
John Bowers <[email protected]> | ||
Jonas Birmé <[email protected]> | ||
Jono Ward <[email protected]> | ||
Jozef Chúťka <[email protected]> | ||
Juan Manuel Tomás <[email protected]> | ||
Julian Domingo <[email protected]> | ||
Jun Hong Chong <[email protected]> | ||
Jürgen Kartnaller <[email protected]> | ||
|
@@ -128,6 +130,7 @@ Sander Saares <[email protected]> | |
Sandra Lokshina <[email protected]> | ||
Sanil Raut <[email protected]> | ||
Satheesh Velmurugan <[email protected]> | ||
Sebastián Piquerez <[email protected]> | ||
Semih Gokceoglu <[email protected]> | ||
Seongryun Jo <[email protected]> | ||
Seth Madison <[email protected]> | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2466,6 +2466,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget { | |
movePlayhead: (delta) => { mediaElement.currentTime += delta; }, | ||
}); | ||
|
||
if (this.cmcdManager_) { | ||
const onPlaybackPlay = () => this.cmcdManager_.onPlaybackPlay(); | ||
const onPlaybackPlaying = () => this.cmcdManager_.onPlaybackPlaying(); | ||
|
||
this.loadEventManager_.listenOnce( | ||
mediaElement, 'play', onPlaybackPlay); | ||
this.loadEventManager_.listenOnce( | ||
mediaElement, 'playing', onPlaybackPlaying); | ||
} | ||
|
||
const updateStateHistory = () => this.updateStateHistory_(); | ||
const onRateChange = () => this.onRateChange_(); | ||
this.loadEventManager_.listen( | ||
|
@@ -3713,6 +3723,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget { | |
getNetworkingEngine: () => this.getNetworkingEngine(), | ||
getVariantTracks: () => this.getVariantTracks(), | ||
isLive: () => this.isLive(), | ||
getLiveLatency: () => this.getLiveLatency(), | ||
}; | ||
|
||
return new shaka.util.CmcdManager(playerInterface, this.config_.cmcd); | ||
|
@@ -5647,6 +5658,25 @@ shaka.Player = class extends shaka.util.FakeEventTarget { | |
return info; | ||
} | ||
|
||
/** | ||
* Get latency in milliseconds between the live edge and what's currently | ||
* playing. | ||
* | ||
* @return {?number} The latency in milliseconds, or null if nothing | ||
* is playing. | ||
*/ | ||
getLiveLatency() { | ||
const element = this.video_; | ||
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. Please check does video element exists. |
||
|
||
if (!element) { | ||
return null; | ||
} | ||
|
||
const now = this.getPresentationStartTimeAsDate().getTime() + | ||
element.currentTime * 1000; | ||
return Date.now() - now; | ||
} | ||
|
||
/** | ||
* Get statistics for the current playback session. If the player is not | ||
* playing content, this will return an empty stats object. | ||
|
@@ -5716,10 +5746,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget { | |
} | ||
|
||
if (this.isLive()) { | ||
const now = this.getPresentationStartTimeAsDate().valueOf() + | ||
element.currentTime * 1000; | ||
const latency = (Date.now() - now) / 1000; | ||
this.stats_.setLiveLatency(latency); | ||
const latency = this.getLiveLatency() || 0; | ||
this.stats_.setLiveLatency(latency / 1000); | ||
} | ||
|
||
if (this.manifest_) { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Please add unit test for this method.