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

Fix: remove player props on dispose to stop middleware #229

Merged
merged 9 commits into from
Dec 6, 2018

Conversation

brandonocasey
Copy link
Contributor

After the tech/vhs is disposed the middleware can still end up running for the next source because player.vhs still exists and that is what the middleware looks for. See: https://github.com/videojs/http-streaming/blob/master/src/middleware-set-current-time.js

@welcome
Copy link

welcome bot commented Sep 13, 2018

💖 Thanks for opening this pull request! 💖

Things that will help get your PR across the finish line:

  • Run npm run lint -- --errors locally to catch formatting errors earlier.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@brandonocasey brandonocasey force-pushed the fix/remove-player-props branch 2 times, most recently from 1531750 to 49aeab8 Compare September 18, 2018 17:58
swfId: player.tech_.el().id
});
clock.tick(1);
if (player.tech_.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.

This helper assumed that hls would always be on tech, which this pr gets rid of.

Copy link
Contributor

Choose a reason for hiding this comment

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

Won't it only get rid of it on dispose though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it should only get rid of it on dispose, but that will happen between sources as well.

@@ -25,10 +25,10 @@ module.exports = function(config) {
'node_modules/video.js/dist/video-js.css',
'dist-test/videojs-http-streaming.test.js'
],
browserConsoleLogOptions: {
/*browserConsoleLogOptions: {
Copy link
Contributor

Choose a reason for hiding this comment

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

commented code

@@ -25,10 +25,10 @@ module.exports = function(config) {
'node_modules/video.js/dist/video-js.css',
'dist-test/videojs-http-streaming.test.js'
],
browserConsoleLogOptions: {
/*browserConsoleLogOptions: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this left in?

swfId: player.tech_.el().id
});
clock.tick(1);
if (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.

Won't it only get rid of it on dispose though?

gesinger
gesinger previously approved these changes Oct 22, 2018
@brandonocasey
Copy link
Contributor Author

This has been on the back burner for awhile, but I picked it pack up and got the tests working! Would be good if you can take another look when you get a chance @gesinger

@@ -252,6 +256,9 @@ export default class HtmlMediaSource extends videojs.EventTarget {
// event handlers left to unbind anyway
if (this.player_.el_) {
this.player_.off('mediachange', this.onPlayerMediachange_);
}

if (this.player_.tech_ && this.player_.tech_.el_) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in some cases the techs element would already be gone at this point.

@@ -969,6 +969,9 @@ export class MasterPlaylistController extends videojs.EventTarget {
this.mainSegmentLoader_.dispose();

['AUDIO', 'SUBTITLES'].forEach((type) => {
if (!this.mediaTypes_[type]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wasn't causing the test failures, but an error was printing for it in a lot of the tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's odd. Do you know what the error was? It seems like both of those media types should exist if an instance of MasterPlaylistController exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A syntax error about media types[type] not existing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did we ever discover what might have been causing it? I'm always a bit hesitant to add code to fix a test error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this https://github.com/videojs/http-streaming/blob/master/test/videojs-http-streaming.test.js#L2884 ? I'll investigate and update the test if that's the problem

Copy link
Contributor

Choose a reason for hiding this comment

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

Confirmed, updating


if (this.player_) {
this.player_.vhs = null;
this.player_.dash = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

There's also player.hls

@@ -325,7 +325,8 @@ class HlsHandler extends Component {
videojs.log.warn('player.hls is deprecated. Use player.tech().hls instead.');
tech.trigger({ type: 'usage', name: 'hls-player-access' });
return this;
}
},
configurable: true
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this property for?

Copy link
Member

Choose a reason for hiding this comment

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

By default configurable is false, means you can't change the value once set.

Copy link
Member

Choose a reason for hiding this comment

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

change including delete.

@@ -969,6 +969,9 @@ export class MasterPlaylistController extends videojs.EventTarget {
this.mainSegmentLoader_.dispose();

['AUDIO', 'SUBTITLES'].forEach((type) => {
if (!this.mediaTypes_[type]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we ever discover what might have been causing it? I'm always a bit hesitant to add code to fix a test error.

@forbesjo forbesjo merged commit cd13f9f into master Dec 6, 2018
@welcome
Copy link

welcome bot commented Dec 6, 2018

Congrats on merging your first pull request! 🎉🎉🎉

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