-
Notifications
You must be signed in to change notification settings - Fork 428
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
Conversation
💖 Thanks for opening this pull request! 💖 Things that will help get your PR across the finish line:
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. |
1531750
to
49aeab8
Compare
swfId: player.tech_.el().id | ||
}); | ||
clock.tick(1); | ||
if (player.tech_.hls) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
test/karma.conf.js
Outdated
@@ -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: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code
test/karma.conf.js
Outdated
@@ -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: { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
cb2578d
to
c22b291
Compare
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_) { |
There was a problem hiding this comment.
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.
src/master-playlist-controller.js
Outdated
@@ -969,6 +969,9 @@ export class MasterPlaylistController extends videojs.EventTarget { | |||
this.mainSegmentLoader_.dispose(); | |||
|
|||
['AUDIO', 'SUBTITLES'].forEach((type) => { | |||
if (!this.mediaTypes_[type]) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, updating
src/videojs-http-streaming.js
Outdated
|
||
if (this.player_) { | ||
this.player_.vhs = null; | ||
this.player_.dash = null; |
There was a problem hiding this comment.
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
b646550
to
b4826b7
Compare
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change including delete.
src/master-playlist-controller.js
Outdated
@@ -969,6 +969,9 @@ export class MasterPlaylistController extends videojs.EventTarget { | |||
this.mainSegmentLoader_.dispose(); | |||
|
|||
['AUDIO', 'SUBTITLES'].forEach((type) => { | |||
if (!this.mediaTypes_[type]) { |
There was a problem hiding this comment.
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.
Congrats on merging your first pull request! 🎉🎉🎉 |
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