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

Initial DASH Support #8

Merged
merged 35 commits into from
Dec 14, 2017
Merged

Initial DASH Support #8

merged 35 commits into from
Dec 14, 2017

Conversation

gesinger
Copy link
Contributor

@gesinger gesinger commented Nov 7, 2017

Description

Initial DASH support with DRM support via videojs-contrib-eme

Will update the documentation, but wanted to put the PR up for early review.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

@forbesjo
Copy link
Contributor

forbesjo commented Nov 7, 2017

It would be nice to have videojs-contrib-eme as a dev dependency and included in the test pages

return options;
}

// upsert the content types based on the selected playlist
Copy link
Contributor

Choose a reason for hiding this comment

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

upsert

@@ -418,6 +455,18 @@ class HlsHandler extends Component {
this.masterPlaylistController_.on('selectedinitialmedia', () => {
// Add the manual rendition mix-in to HlsHandler
renditionSelectionMixin(this);

if (this.options_.sourceType === 'dash') {
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to put this in like a this.setupEmeOptions_()

// if the first mime type has muxed video and audio then we shouldn't wait on the
// second source buffer
mimeTypes.length > 1 && mimeTypes[0].indexOf(',') === -1 ?
new videojs.EventTarget() : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

we might want to think about expanding this emitter concept to its own controller class. When we start tearing apart flash and pulling the muxer into vhs and removing contrib-media-sources, we will still need a place for some of the contrib-media-sources logic to live e.g. buffer management logic that was added to address the edge/ie corruption issues

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that we may end up needing that, but for now I think it's best to hold off. We may not get to it for a while, and if we do get to it sooner, it may end up having different requirements than we suppose right now.

}
}

media(playlist) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to get function comments here? Mostly I'm asking as this has a few pieces of nuance (the playlist can be a string or object, and thus will be handled differently, as well as the fact that it is both a getter and a setter).


const mediaChange = !this.media_ || playlist.uri !== this.media_.uri;

this.state = 'HAVE_METADATA';
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these states doc'ed anywhere? Might be nice to have them doc'ed in some form, as it might make debugging easier (particularly if there is a sequence to these events).

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah nice, this is what I was looking for.

for (let i = 0; i < this.master.playlists.length; i++) {
const phonyUri = `placeholder-uri-${i}`;

this.master.playlists[i].uri = phonyUri;
Copy link
Contributor

Choose a reason for hiding this comment

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

should also add resolvedUri here, quite a few places outside of this class use resolvedUri instead of uri

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe not quite a few since media-groups has source type checking now, but there is a spot in MPC and external plugins may look for it

Copy link
Contributor Author

@gesinger gesinger Nov 20, 2017

Choose a reason for hiding this comment

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

I forgot, it actually gets added in setupMediaPlaylists

@@ -516,7 +516,7 @@ export default class SyncController extends videojs.EventTarget {
time: segment.start,
accuracy: 0
};
} else if (playlist.discontinuityStarts.length) {
} else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will probably depend on how we plan to handle multi-period dash, and this extra check isn't problematic in anyway, but m3u8-parser always attaches an empty array for discontinuityStarts. If we plan to treat multi-period dash as discontinuities, then this check may be unnecessary, but still ok to be there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. I think we can just leave it in until we handle multi-period dash in the mpd-parser (so we know for sure).

const sourceType = simpleTypeFromSourceType(type);

if (sourceType === 'dash') {
if (!options.hls.overrideNative && Hls.supportsNativeDash) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should always override native DASH playback

// isn't the most appropriate form of reference for video.js (since all APIs should
// be provided through core video.js), it is a common pattern for plugins, and vhs
// will act accordingly.
_player.vhs = this;
Copy link
Contributor

Choose a reason for hiding this comment

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

We need this to map to deprecated player.dash and player.hls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did we have a player.hls? I though just player.tech_.hls

Copy link
Contributor

Choose a reason for hiding this comment

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

Uses could access player.hls.representations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot that it's already available (albeit deprecated). Since it still exists they should be able to continue to use it without issue.

Copy link
Contributor

@forbesjo forbesjo left a comment

Choose a reason for hiding this comment

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

Requires a videojs-contrib-eme version

@forbesjo forbesjo mentioned this pull request Dec 12, 2017
4 tasks
package.json Outdated
@@ -92,6 +92,7 @@
"global": "^4.3.0",
"m3u8-parser": "2.1.0",
"mux.js": "4.3.2",
"mpd-parser": "0.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

mpd-parser is now on 0.2.0

package.json Outdated
@@ -134,6 +135,7 @@
"shelljs": "^0.5.3",
"sinon": "1.10.2",
"uglify-js": "^2.5.0",
"videojs-contrib-eme": "http://github.com/gesinger/videojs-contrib-eme#options-rework",
Copy link
Contributor

Choose a reason for hiding this comment

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

Remember to point to a contrib-eme version with the necessary changes

@forbesjo
Copy link
Contributor

Looks good to me

Lead Maintainers:
- Jon-Carlos Rivera [@imbcmdth](https://github.com/imbcmdth)
- Joe Forbes [@forbesjo](https://github.com/forbesjo)
- Matthew Neil [@mjneil](https://github.com/mjneil)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@@ -105,6 +106,29 @@ const getCodecs = function(media) {
return defaultCodecs;
};

const audioProfileFromDefault = (master, audioGroupId) => {
Copy link
Contributor

@mjneil mjneil Dec 13, 2017

Choose a reason for hiding this comment

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

Maybe this would be a good opportunity to move this and other codec related helper functions into util/codecs.js to help cleanup this file a bit?

};
};

const setupEmeOptions = (hlsHandler) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

probably would be better to use vhsHandler naming

Copy link
Contributor

Choose a reason for hiding this comment

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

just realized, are we not making name changes for HlsHandler my hls->vhs name change suggestions probably shouldn't be done then

@@ -546,7 +622,7 @@ const HlsSourceHandler = function(mode) {
tech.hls = new HlsHandler(source, tech, localOptions);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to make this be tech.vhs and point tech.hls = tech.vhs for backwards comp?

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:full:2011" minBufferTime="1.5" mediaPresentationDuration="PT4S">
<Period>
<BaseURL>main/</BaseURL>
<AdaptationSet mimeType="video/mp4">
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add an AdaptionSet for vtt since mpd-parser 0.2.0 supports vtt now?

@forbesjo
Copy link
Contributor

Going to merge this and open the suggested comments in a new PR.

@forbesjo forbesjo merged commit 4021637 into videojs:master Dec 14, 2017
forbesjo pushed a commit to forbesjo/http-streaming that referenced this pull request Jan 30, 2018
gesinger added a commit that referenced this pull request Apr 11, 2019
…e-updater-duration

Use source updater to update media source duration
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