- Restart video play activity with correct data on trigger from notification
This commit is contained in:
parent
eeb2fcd5f0
commit
519fdb7b00
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "net.schueller.peertube"
|
applicationId "net.schueller.peertube"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 108
|
versionCode 109
|
||||||
versionName "1.0.8"
|
versionName "1.0.9"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
@ -206,14 +206,14 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
{
|
{
|
||||||
// get video ID
|
// get video ID
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String videoID = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
|
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
|
||||||
Log.v(TAG, "click: " + videoID);
|
Log.v(TAG, "click: " + videoUuid);
|
||||||
|
|
||||||
// get video details from api
|
// get video details from api
|
||||||
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
|
||||||
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
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>() {
|
call.enqueue(new Callback<Video>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -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_PAUSE;
|
||||||
import static android.media.session.PlaybackState.ACTION_PLAY;
|
import static android.media.session.PlaybackState.ACTION_PLAY;
|
||||||
|
import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID;
|
||||||
|
|
||||||
public class VideoPlayerService extends Service {
|
public class VideoPlayerService extends Service {
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ public class VideoPlayerService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public PendingIntent createCurrentContentIntent(Player player) {
|
public PendingIntent createCurrentContentIntent(Player player) {
|
||||||
Intent intent = new Intent(context, VideoPlayActivity.class);
|
Intent intent = new Intent(context, VideoPlayActivity.class);
|
||||||
|
intent.putExtra(EXTRA_VIDEOID, currentVideo.getUuid());
|
||||||
return PendingIntent.getActivity(context, 0, intent,
|
return PendingIntent.getActivity(context, 0, intent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
}
|
}
|
||||||
@ -179,6 +181,9 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
playerNotificationManager.setSmallIcon(R.drawable.ic_peertube_bw);
|
playerNotificationManager.setSmallIcon(R.drawable.ic_peertube_bw);
|
||||||
|
|
||||||
|
// don't show skip buttons in notification
|
||||||
|
playerNotificationManager.setUseNavigationActions(false);
|
||||||
|
|
||||||
playerNotificationManager.setNotificationListener(
|
playerNotificationManager.setNotificationListener(
|
||||||
new PlayerNotificationManager.NotificationListener() {
|
new PlayerNotificationManager.NotificationListener() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user