-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ref(ios, events): improve disabling of playback-progress-updated #1706
ref(ios, events): improve disabling of playback-progress-updated #1706
Conversation
- When 0 is passed to `options["progressUpdateEventInterval”]` in order to disable ‘playback-progress-updated’ event, set `timeEventFrequency` back to the default of every second. - rename shouldEmitUpdateEventInterval to shouldEmitProgressEvent
@puckey was this already the default behavior on the Kotlin side? |
Good point – I haven't checked that yet. Let's keep this open until I have done so. |
@jspizziri I am unable to find the same issue on the kotlin side that ios has where you are unable to 'cancel' this interval (see your comments here: react-native-track-player/ios/RNTrackPlayer/RNTrackPlayer.swift Lines 817 to 821 in a243210
Here is the kotlin side which looks like it cancels the job and then doesn't recreate it when set to Lines 152 to 159 in e94e436
|
shouldEmitProgressEvent = interval > 0 | ||
self.player.timeEventFrequency = shouldEmitProgressEvent | ||
? .custom(time: CMTime(seconds: interval, preferredTimescale: 1)) | ||
: .everySecond |
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.
The big difference I see here is that we're setting the interval to 1s when we cancel, which we weren't doing before. Are we sure this is desired?
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.
the reason I am doing this is that the user might have set the interval to something very small temporarily, expecting that setting it back to 0
would return stuff to normal.. (I was going off the comment that says it is impossible to turn it off..)
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.
See the default value here in SwiftAudioEx: https://github.com/doublesymmetry/SwiftAudioEx/blob/main/SwiftAudioEx/Classes/AVPlayerWrapper/AVPlayerWrapper.swift#L136
Left a question, but lgtm apart from that. |
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!
options["progressUpdateEventInterval”]
in order to disable ‘playback-progress-updated’ event, settimeEventFrequency
back to the default of every second.