Skip to content
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

created seekpodcast event and fixed podcast seeking #1257

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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