-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Accessing/Manipulating multiple player sources #2443
Comments
If you're just looking for a file-based resolution changer, I think there's still one in the plugins listing. I'm not sure exactly how it pulls this off, but that type of functionality makes the most sense as a plugin. However we could consider adding some way of accessing the original sources provided. The options() path would only work if you used source elements to provide the multiple sources, instead of the src() api. |
There is 2 one that is new and one that isn't supported anymore. https://github.com/vidcaster/video-js-resolutions/blob/master/video-js-resolutions.js#L424 (old) Both players rely on It would be great if sources can have the same/similar interaction API, whether or not they are inline or not. It seems like tracks are already handled for this case (albeit kind of weird): videojs('player').player().options().tracks
// vs.
videojs('player').textTracks Thinking of solutions… Additionally, I noticed that: https://github.com/videojs/video.js/blob/master/src/js/player.js#L1675 src() // returns this.techGet('src'); https://github.com/videojs/video.js/blob/master/src/js/player.js#L1780 currentSrc() // returns this.techGet('src') || this.cache_.src || ''; Not sure if these were intended to be doing similar, but different operations. My first thought would be to modify https://github.com/videojs/video.js/blob/master/src/js/player.js#L1738 And Potentially, this has already been thought of as its I am willing to make the jump to 5.0 rc if I can leverage this feature. And I am willing to contribute to the core, but I am not very familiar with the tools or architectural direction yet. |
What about managing this in two parts? Line 1684 in ed790fd
if (vjs.obj.isArray(source)) {
this.cache_.sourceList = source; // save raw source list [The only time there would be more than 1]
this.sourceList_(source);
... Line 1700 in ed790fd
this.cache_.src = source.src;
this.cache_.source = source; // save raw source
this.currentType_ = source.type || ''; Line 522 in ed790fd
this.cache_.src = source.src;
this.cache_.source = source; // save raw source rawSourceList: function () {
return this.cache_.sourceList.concat(this.player_.options_.sources);
}
rawSource: function () {
return this.cache_.source;
} It is still possible that I am not sure if this is how @heff Thoughts? |
Overall, I think this could be a valuable addition. @videojs/core-committers any other opinions?
We heavily discourage talking to the tech direction, or using techCall, because of reasons like this. So I don't think that should be an issue.
I like the idea of adding:
Sources can be set in a few different ways so I think if we can simplify accessing that information it could be helpful. I think using a For example, when you set a source with the src() function, all we have is the url.
The last two add some complexity but I think it's worth it to make the return values consistent. And I think you can use the |
It feels weird not to have a correctly configured This still aligns with the end goal of being able to use And… // yes have the tech worry about generating the additional details—no talk
player.src('http://foo.com/video.mp4'); Ideally we would want
I'll have to double check, but I am not sure at what point does the player have access to values other than raw data. Definitely agree and am in favor of consistency. I will look into achieving those Though still open to other alternatives. |
Great, it sounds like we're thinking in the same direction. |
Has there been any thought about being able to access any/all sources provided to the player?
https://github.com/videojs/video.js/blob/master/docs/api/vjs.Player.md#src-source-
I am guessing for the typical case it doesn't matter which it plays, as long as it plays.
The use case might be...
This may be more easily achieved if your utilizing
source
tags, but for src's with larger configuration/protection data. I don't believe you have the luxury.The end goal might be to create a resolution changer.
The closest thing I found, but didn't really work was
vjs('player').player().options().sources // []
Similarly, with playroll (
videojs-contrib-ads
), you cannot hot swap sources with protected data, because there is no way of obtaining sources that are dynamically attached.…i think…
The text was updated successfully, but these errors were encountered: