Skip to content

Commit

Permalink
Merge pull request #1257 from annasoin/fix-seeking
Browse files Browse the repository at this point in the history
created seekpodcast event and fixed podcast seeking
  • Loading branch information
David-Development authored Sep 10, 2023
2 parents f0593ed + d21d1f0 commit de1b132
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import de.luhmer.owncloudnewsreader.events.podcast.StartDownloadPodcast;
import de.luhmer.owncloudnewsreader.events.podcast.TogglePlayerStateEvent;
import de.luhmer.owncloudnewsreader.events.podcast.WindPodcast;
import de.luhmer.owncloudnewsreader.events.podcast.SeekPodcast;
import de.luhmer.owncloudnewsreader.model.PodcastFeedItem;
import de.luhmer.owncloudnewsreader.model.PodcastItem;
import de.luhmer.owncloudnewsreader.services.PodcastDownloadService;
Expand Down Expand Up @@ -303,12 +304,10 @@ public void onStopTrackingTouch(final SeekBar seekBar) {
long ms = Math.round((after / 100d) * maxPositionInMillis);
Log.v(TAG, "onStopTrackingTouch - after (%): " + after + " - ms: " + ms);

eventBus.post(new WindPodcast(ms));
eventBus.post(new SeekPodcast(ms));
blockSeekbarUpdate = false;
}
};
// TODO SEEK DOES NOT WORK PROPERLY!!!!


private void showPlaybackSpeedPicker() {
final NumberPicker numberPicker = new NumberPicker(getContext());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package de.luhmer.owncloudnewsreader.events.podcast;

public class SeekPodcast {

public double milliSeconds;

public SeekPodcast(double milliSeconds) {
this.milliSeconds = milliSeconds;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import de.luhmer.owncloudnewsreader.events.podcast.SpeedPodcast;
import de.luhmer.owncloudnewsreader.events.podcast.TogglePlayerStateEvent;
import de.luhmer.owncloudnewsreader.events.podcast.WindPodcast;
import de.luhmer.owncloudnewsreader.events.podcast.SeekPodcast;
import de.luhmer.owncloudnewsreader.model.MediaItem;
import de.luhmer.owncloudnewsreader.model.PodcastFeedItem;
import de.luhmer.owncloudnewsreader.model.PodcastItem;
Expand Down Expand Up @@ -447,6 +448,14 @@ public void onEvent(WindPodcast event) {
}
}

@Subscribe
public void onEvent(SeekPodcast event) {
if(mPlaybackService != null) {
int seekTo = (int) (event.milliSeconds);
mPlaybackService.seekTo(seekTo);
}
}

@Subscribe
public void onEvent(RegisterVideoOutput videoOutput) {
if(mPlaybackService != null && mPlaybackService instanceof MediaPlayerPlaybackService) {
Expand Down

0 comments on commit de1b132

Please sign in to comment.