-
Notifications
You must be signed in to change notification settings - Fork 1
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: allow triggering of events after a stream has reached the end #217
Conversation
@oscnord this is by design ( see https://github.com/Eyevinn/media-event-filter#limitations ), but is something we want so support #3. We just have to test it very thoroughly so that the event flow works properly. |
Ah okay, I should have checked the open issues... 🤦♂️ |
src/media-event-filter.ts
Outdated
@@ -114,7 +116,7 @@ export const getMediaEventFilter = ({ | |||
...initialState, | |||
}; | |||
|
|||
const isNotReady = (): boolean => state.loading; | |||
const isNotReady = (): boolean => allowResumeAfterEnded ? state.loading : state.loading || state.ended; |
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.
Isn't this the wrong way around?
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.
If allowResumeAfterEnded
is true
we want to allow triggering of events i.e only checking state.loading
. If false
we want to have the same behaviour as before.
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.
Or maybe I'm wrong(?)
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.
if allowResumeAfterEnded
( or maybe allowPlaybackAfterEnded
is a clearer name 🤔 ) is true
we want the new behavior, if false ( default ) we want the old behavior.
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.
I'm a dumb dumb, misunderstood the code 🤦
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.
LGTM 👍
2961eb1
to
4d5c7f6
Compare
4d5c7f6
to
38abf62
Compare
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 PR fixes an issue where events wouldn't be emitted after the end state due to
isNotReady
being set to true even if the video element would trigger play/pause/seek etc.