Skip to content

Commit

Permalink
Fix playback stop reported twice
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Oct 5, 2023
1 parent bbeb707 commit 21fd221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1107,12 +1107,12 @@ public void stop() {
stopReportLoop();
if (mPlaybackState != PlaybackState.IDLE && mPlaybackState != PlaybackState.UNDEFINED) {
mPlaybackState = PlaybackState.IDLE;
}

if (mVideoManager != null && mVideoManager.isPlaying()) mVideoManager.stopPlayback();
Long mbPos = mCurrentPosition * 10000;
ReportingHelper.reportStopped(getCurrentlyPlayingItem(), getCurrentStreamInfo(), mbPos);
clearPlaybackSessionOptions();
if (mVideoManager != null && mVideoManager.isPlaying()) mVideoManager.stopPlayback();
Long mbPos = mCurrentPosition * 10000;
ReportingHelper.reportStopped(getCurrentlyPlayingItem(), getCurrentStreamInfo(), mbPos);
clearPlaybackSessionOptions();
}
}

public void refreshStream() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public class ReportingHelper {
public static void reportStopped(org.jellyfin.sdk.model.api.BaseItemDto item, StreamInfo streamInfo, long pos) {
if (item != null && streamInfo != null) {
Timber.i("ReportingHelper.reportStopped called for " + item.getId() + " at position " + pos);
PlaybackStopInfo info = new PlaybackStopInfo();
info.setItemId(item.getId().toString());
info.setPositionTicks(pos);
Expand Down

0 comments on commit 21fd221

Please sign in to comment.