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

Method for Accessing Source Objects #3564

Closed
gesinger opened this issue Aug 23, 2016 · 3 comments
Closed

Method for Accessing Source Objects #3564

gesinger opened this issue Aug 23, 2016 · 3 comments

Comments

@gesinger
Copy link
Contributor

tl;dr: Looking for a way to get the source object (not just the src URL) from the player.

In developing videojs-contrib-eme, we came across a problem. We needed to, as a plugin, get per-source options. This is because each source needs to have a different set of methods/URLs for accessing certificates and keys.

In the current code, we avoid this problem by having the user pass in the options via player.contribEme(options), and we save them and use them from that point on. However, this is cumbersome, as the user has to have more intimate knowledge about event ordering to properly set options when a new source is set, and isn't the cleanest approach.

Instead, we'd prefer to be able to pass in a source/sources to Video.js with the custom properties attached to the object. This would be the normal approach for a custom tech that needs certain properties to run, and we considered writing videojs-contrib-eme as a custom tech, however, that would not allow us to play together alongside any other tech (e.g., videojs-contrib-hls and videojs-contrib-dash). Instead, as a plugin, we want to be able to call player.source(), or something similar, and get the full source object (or individual object as part of an array) as it was passed into Video.js.

This would mean we could listen for an event that indicates a source change (if there is one, or one similar enough -- otherwise that may be another consideration we'd like to make), and grab the current source object to use along with the properties we need.

In the meantime, a workaround that isn't clean but could function in the meantime (provided by @imbcmdth ), is that we create a fake source handler that always returns false, but grabs the source object to use in the plugin.

Thank you!

@gkatsev
Copy link
Member

gkatsev commented Aug 25, 2016

This sounds really similar to #2443, which @chemoish opened a PR for some time ago ( #2678 ). I wonder whether that would work for this as well, in which case, we just need to finish the PR.

@gesinger
Copy link
Contributor Author

You're right @gkatsev . That PR looks to be exactly what we're looking for. I can check out that branch, rebase, give it a quick test, and create a new PR (as I won't be able to update the old branch).

@gkatsev
Copy link
Member

gkatsev commented Dec 8, 2016

Fixed via #2678

@gkatsev gkatsev closed this as completed Dec 8, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants