- Restart video play activity with correct data on trigger from notification

This commit is contained in:
Stefan Schueller 2018-12-17 21:32:01 +01:00
parent eeb2fcd5f0
commit 519fdb7b00
3 changed files with 10 additions and 5 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "net.schueller.peertube"
minSdkVersion 21
targetSdkVersion 28
versionCode 108
versionName "1.0.8"
versionCode 109
versionName "1.0.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

View File

@ -206,14 +206,14 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
{
// get video ID
Intent intent = getIntent();
String videoID = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
Log.v(TAG, "click: " + videoID);
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
Log.v(TAG, "click: " + videoUuid);
// get video details from api
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
Call<Video> call = service.getVideoData(videoID);
Call<Video> call = service.getVideoData(videoUuid);
call.enqueue(new Callback<Video>() {
@Override

View File

@ -32,6 +32,7 @@ import net.schueller.peertube.model.Video;
import static android.media.session.PlaybackState.ACTION_PAUSE;
import static android.media.session.PlaybackState.ACTION_PLAY;
import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID;
public class VideoPlayerService extends Service {
@ -156,6 +157,7 @@ public class VideoPlayerService extends Service {
@Override
public PendingIntent createCurrentContentIntent(Player player) {
Intent intent = new Intent(context, VideoPlayActivity.class);
intent.putExtra(EXTRA_VIDEOID, currentVideo.getUuid());
return PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
}
@ -179,6 +181,9 @@ public class VideoPlayerService extends Service {
playerNotificationManager.setSmallIcon(R.drawable.ic_peertube_bw);
// don't show skip buttons in notification
playerNotificationManager.setUseNavigationActions(false);
playerNotificationManager.setNotificationListener(
new PlayerNotificationManager.NotificationListener() {
@Override