Skip to content
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: inferred stream type #592

Merged
merged 55 commits into from
Apr 12, 2023

Conversation

cjpillsbury
Copy link
Contributor

@cjpillsbury cjpillsbury commented Feb 27, 2023

Implementing inferred stream types and related (targetLiveWindow, liveEdgeStart).

This PR removes the requirement for setting stream type, which can now be inferred directly from the media. Note that, since this process is asynchronous and does not begin until the media metadata is requested (aka will not immediately begin if preload="none"), this means that, for our current UI designs, folks will see an "on demand" UI until the streamType and related has been inferred (at least by default).

Additionally, for this iteration, we will continue to support/translate "invalid" stream types to their appropriate corresponding properties/attributes. See https://github.com/cjpillsbury/elements/blob/feat/inferred-stream-type/errors/deprecated-stream-type.md for how to migrate now-deprecated stream types.

Finally, there is now a distinct default-stream-type/defaultStreamType attribute/property for cases where we want a different UI to show by default. I've treated any corresponding "default-target-live-window" attr/prop as out of scope for this iteration, as there is no corresponding implementation within Media Chrome.

@vercel
Copy link

vercel bot commented Feb 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
elements-demo-create-react-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 11:27pm
elements-demo-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 11:27pm
elements-demo-svelte-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 11:27pm
elements-demo-vanilla ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 11:27pm
elements-demo-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 11:27pm

.then((mediaPlaylistStr) => {
const typeLine = mediaPlaylistStr.split('\n').find((line) => line.startsWith('#EXT-X-PLAYLIST-TYPE')) ?? '';

const playlistType = typeLine.split(':')[1]?.trim() as HlsPlaylistTypes;
Copy link
Contributor Author

@cjpillsbury cjpillsbury Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a block of identical code here and in the hls.js use case. Break into a shared function?

@@ -2,78 +2,65 @@
{
"playback-id": "a4nOgmxGWg6gULfcBbAa00gXyfcwPnAFldF8RdsNyk8M",
"description": "Landscape VOD",
"stream-type": "on-demand",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the explicit stream type for testing inferred behavior, but we may want to consider keeping these values removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in this PR.

yarn.lock Outdated Show resolved Hide resolved
@@ -700,24 +707,22 @@ class MuxPlayerElement extends VideoApiElement {
* we aren't an audio player and the stream-type isn't live.
*/
get storyboard() {
// If the storyboardSrc has been explicitly set, assume it should be used
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally changed the rules here a bit to always prefer the storyboardSrc if it's explicitly set to unlock e.g. audio themes that have storyboards.

luwes
luwes previously requested changes Feb 28, 2023
packages/mux-player/src/template.ts Show resolved Hide resolved
Copy link
Contributor

@luwes luwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

one thing I also have to remind myself of is keep the PR small enough.
ideally something like half the size of this, sometimes it's difficult but this one could have been split up in a few I think. would also help with merge conflicts. faster reviews / merges

Copy link
Contributor

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and verified that changing the stream type from DVR to others is fixed.

@@ -0,0 +1,23 @@
# Deprecated Stream Type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) -- open to other opinions.

Can we put this on a branch for safe keeping? Feels weird to have it in the repo if it's never linked.

Might also want to put the commented code on a branch. Feels a little sloppy to have commented out code making it into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants