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: add external vhs properties and deprecate hls and dash references #859

Merged
merged 14 commits into from
Jun 15, 2020

Conversation

gesinger
Copy link
Contributor

Description

Deprecate lingering references to hls from the old videojs-contrib-hls project, as well as dash. Ensure all references use "vhs" instead.

Remove unused utils/fixtures dir.

Requirements Checklist

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

gesinger added 3 commits May 29, 2020 17:12
Deprecate lingering references to hls from the old videojs-contrib-hls
project, as well as dash. Ensure all references use "vhs" instead.

Remove unused utils/fixtures dir.
gkatsev
gkatsev previously approved these changes Jun 10, 2020
Copy link
Member

@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.

This is amazing work @gesinger.
I haven't test it yet but changes look good. (I'll come back to re-test after reviewing the other VHS 2.0 related PRs)

@@ -16,11 +16,11 @@ QUnit.test('the environment is sane', function(assert) {
} else {
assert.strictEqual(typeof window.URL, 'function', 'URL is a function');
}
assert.strictEqual(typeof videojs.Hls, 'object', 'Hls is an object');
Copy link
Member

Choose a reason for hiding this comment

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

We probably want to keep this old section and add the updated lines as a new section.

Copy link
Member

Choose a reason for hiding this comment

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

This may also be a good place to add checks for things that we want to update the name of but still be available via the old way. I'll spend some time looking through issues to see usage and add a comment if I find something interesting that we should test for.

Copy link
Member

Choose a reason for hiding this comment

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

I see that there's some deprecation warning tests in the VHS.test.js file, so, this is probably fine as is in that case.

@@ -350,22 +354,37 @@ class HlsHandler extends Component {
if (!_player.hasOwnProperty('hls')) {
Object.defineProperty(_player, 'hls', {
get: () => {
videojs.log.warn('player.hls is deprecated. Use player.tech().hls instead.');
videojs.log.warn('player.hls is deprecated. Use player.vhs instead.');
tech.trigger({ type: 'usage', name: 'vhs-player-access' });
Copy link
Member

Choose a reason for hiding this comment

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

should this trigger vhs-player-access? It sounds like this was used to track player.hls usage specifically. So, we probably don't want to trigger this here and only trigger hls-player-access.

Also, if we are un-deprecating usage of player.vhs, maybe we don't need vhs-player-access?

Copy link
Member

Choose a reason for hiding this comment

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

Apparently player.vhs didn't have a deprecation warning on it while player.hls did.

Thinking about it some more, I think we should keep player.vhs and player.hls deprecated in favor of player.tech().vhs. Most users don't care about anything VHS related and it's highly dependent on the tech being used. I think accessing it via the tech makes sense and is safer.

Thoughts? Also, happy to pitch in and make the player.vhs -> player.tech().vhs changes in players.

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 think player.tech().vhs is fine (and makes sense), but I'd just be a bit worried that we do have a decent number of APIs and recommended calls that are at the vhs level (rather than at the video.js level) and if we recommend using player.tech().vhs people are going to see lots of warning logs in the console:

VIDEOJS: WARN: Using the tech directly can be dangerous. I hope you know what you're doing.
See https://github.com/videojs/video.js/issues/2617 for more info.

Which might seem confusing to users (and potentially bothersome). Should we consider removing that log message in video.js?

Copy link
Member

Choose a reason for hiding this comment

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

At the very least, we should make a better landing page for that log. That currently points to the v5 related issue that recommends IWillNotUseThisInPlugins. We can create a page on the wiki (or on the videojs.com site) that says something along the lines of "be careful of doing stuff on the tech, pass in a value like true to suppress the warning".

I do think the warning is useful because a lot of people copy snippets of code without looking into the code. Hopefully, that warning is helping people think more about it.

@gkatsev
Copy link
Member

gkatsev commented Jun 10, 2020

Also, from a quick test, this LGTM as stuff like setting beforeRequest as previously used, should be fine.

@@ -237,15 +238,15 @@ parts of video.js:
// html5 for html hls
videojs(video, {
html5: {
Copy link
Contributor

Choose a reason for hiding this comment

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

This pull request also makes me wonder if we should support top level vhs options rather than just html5 -> vhs options

src/xhr.js Show resolved Hide resolved
};

// HLS is a source handler, not a tech. Make sure attempts to use it
// as one do not cause exceptions.
Hls.canPlaySource = function() {
Vhs.canPlaySource = function() {
return videojs.log.warn('HLS is no longer a tech. Please remove it from ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this read HLS/VHS?

@gkatsev
Copy link
Member

gkatsev commented Jun 15, 2020

gesinger#11

gkatsev and others added 3 commits June 15, 2020 16:56
@gkatsev gkatsev merged commit 22af0b2 into videojs:master Jun 15, 2020
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.

3 participants