Thorium-android-app/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java

359 lines
14 KiB
Java
Raw Normal View History

2018-12-29 14:19:17 +01:00
/*
2020-11-28 22:36:47 +01:00
* Copyright (C) 2020 Stefan Schüller <sschueller@techdroid.com>
2018-12-29 14:19:17 +01:00
*
* This program is free software: you can redistribute it and/or modify
2020-11-28 22:36:47 +01:00
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2018-12-29 14:19:17 +01:00
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2020-11-28 22:36:47 +01:00
* GNU Affero General Public License for more details.
2018-12-29 14:19:17 +01:00
*
2020-11-28 22:36:47 +01:00
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-12-29 14:19:17 +01:00
*/
package net.schueller.peertube.service;
2021-10-04 09:42:35 +02:00
import static android.media.session.PlaybackState.ACTION_PAUSE;
import static android.media.session.PlaybackState.ACTION_PLAY;
import static com.google.android.exoplayer2.ui.PlayerNotificationManager.ACTION_STOP;
import static net.schueller.peertube.activity.VideoListActivity.EXTRA_VIDEOID;
import static net.schueller.peertube.network.UnsafeOkHttpClient.getUnsafeOkHttpClientBuilder;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Binder;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v4.media.MediaDescriptionCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.util.Log;
2021-10-04 09:42:35 +02:00
import android.webkit.URLUtil;
2019-01-04 16:52:09 +01:00
import android.widget.Toast;
2021-10-04 09:42:35 +02:00
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
2021-01-24 00:31:51 +01:00
import com.google.android.exoplayer2.MediaItem;
2018-12-24 05:30:32 +01:00
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
import com.google.android.exoplayer2.ext.mediasession.TimelineQueueNavigator;
2020-11-22 13:54:54 +01:00
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory;
2021-01-24 00:31:51 +01:00
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
2021-01-24 17:58:40 +01:00
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.ui.PlayerNotificationManager;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.util.Util;
import net.schueller.peertube.R;
import net.schueller.peertube.activity.VideoPlayActivity;
2020-11-22 13:54:54 +01:00
import net.schueller.peertube.helper.APIUrlHelper;
import net.schueller.peertube.helper.MetaDataHelper;
import net.schueller.peertube.model.Video;
2020-11-22 13:54:54 +01:00
import okhttp3.OkHttpClient;
public class VideoPlayerService extends Service {
2018-12-26 15:24:02 +01:00
private static final String TAG = "VideoPlayerService";
private static final String MEDIA_SESSION_TAG = "peertube_player";
2018-12-26 15:24:02 +01:00
private final IBinder mBinder = new LocalBinder();
private static final String PLAYBACK_CHANNEL_ID = "playback_channel";
private static final Integer PLAYBACK_NOTIFICATION_ID = 1;
public SimpleExoPlayer player;
private Video currentVideo;
private String currentStreamUrl;
2021-01-24 17:58:40 +01:00
private boolean currentStreamUrlIsHLS;
private PlayerNotificationManager playerNotificationManager;
private IntentFilter becomeNoisyIntentFilter = new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
private BecomingNoisyReceiver myNoisyAudioStreamReceiver = new BecomingNoisyReceiver();
@Override
public void onCreate() {
2019-01-04 16:52:09 +01:00
Log.v(TAG, "onCreate...");
super.onCreate();
2021-01-24 00:31:51 +01:00
player = new SimpleExoPlayer.Builder(getApplicationContext())
.setTrackSelector(new DefaultTrackSelector(getApplicationContext()))
.build();
// Stop player if audio device changes, e.g. headphones unplugged
player.addListener(new Player.EventListener() {
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ACTION_PAUSE) { // this means that pause is available, hence the audio is playing
2018-12-26 15:24:02 +01:00
Log.v(TAG, "ACTION_PLAY: " + playbackState);
registerReceiver(myNoisyAudioStreamReceiver, becomeNoisyIntentFilter);
}
if (playbackState
== ACTION_PLAY) { // this means that play is available, hence the audio is paused or stopped
2018-12-26 15:24:02 +01:00
Log.v(TAG, "ACTION_PAUSE: " + playbackState);
safeUnregisterReceiver();
}
}
});
}
public class LocalBinder extends Binder {
public VideoPlayerService getService() {
// Return this instance of VideoPlayerService so clients can call public methods
return VideoPlayerService.this;
}
}
@Override
public void onDestroy() {
2018-12-26 15:24:02 +01:00
Log.v(TAG, "onDestroy...");
if (playerNotificationManager != null) {
playerNotificationManager.setPlayer(null);
}
//Was seeing an error when exiting the program about not unregistering the receiver.
safeUnregisterReceiver();
if (player != null) {
player.release();
player = null;
}
super.onDestroy();
}
private void safeUnregisterReceiver()
{
try {
unregisterReceiver(myNoisyAudioStreamReceiver);
} catch (Exception e) {
Log.e("VideoPlayerService", "attempted to unregister a nonregistered service");
}
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
2019-01-04 16:52:09 +01:00
Context context = this;
2018-12-26 15:24:02 +01:00
Log.v(TAG, "onStartCommand...");
if (!URLUtil.isValidUrl(currentStreamUrl)) {
Toast.makeText(context, "Invalid URL provided. Unable to play video.", Toast.LENGTH_SHORT).show();
return START_NOT_STICKY;
} else {
playVideo();
return START_STICKY;
2019-01-04 16:52:09 +01:00
}
}
public void setCurrentVideo(Video video) {
2018-12-26 15:24:02 +01:00
Log.v(TAG, "setCurrentVideo...");
currentVideo = video;
}
2021-01-24 17:58:40 +01:00
public void setCurrentStreamUrl(String streamUrl, boolean isHLS) {
2019-01-04 16:52:09 +01:00
Log.v(TAG, "setCurrentStreamUrl..." + streamUrl);
2021-01-24 17:58:40 +01:00
currentStreamUrlIsHLS = isHLS;
currentStreamUrl = streamUrl;
}
2018-12-24 05:30:32 +01:00
//Playback speed control
public void setPlayBackSpeed(float speed) {
2018-12-26 15:24:02 +01:00
Log.v(TAG, "setPlayBackSpeed...");
2018-12-24 05:30:32 +01:00
player.setPlaybackParameters(new PlaybackParameters(speed));
}
/**
* Returns the current playback speed of the player.
*
* @return the current playback speed of the player.
*/
public float getPlayBackSpeed() {
return player.getPlaybackParameters().speed;
}
2018-12-24 05:30:32 +01:00
public void playVideo() {
Context context = this;
// We need a valid URL
2018-12-26 15:24:02 +01:00
Log.v(TAG, "playVideo...");
// Produces DataSource instances through which media data is loaded.
2020-11-22 13:54:54 +01:00
// DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(),
// Util.getUserAgent(getApplicationContext(), "PeerTube"), null);
OkHttpClient.Builder okhttpClientBuilder;
if (!APIUrlHelper.useInsecureConnection(this)) {
okhttpClientBuilder = new OkHttpClient.Builder();
} else {
okhttpClientBuilder = getUnsafeOkHttpClientBuilder();
}
2021-01-24 00:31:51 +01:00
// Create a data source factory.
2020-11-22 13:54:54 +01:00
DataSource.Factory dataSourceFactory = new OkHttpDataSourceFactory(okhttpClientBuilder.build(), Util.getUserAgent(getApplicationContext(), "PeerTube"));
2021-01-24 00:31:51 +01:00
// Create a progressive media source pointing to a stream uri.
2021-01-24 17:58:40 +01:00
MediaSource mediaSource;
if (currentStreamUrlIsHLS) {
mediaSource = new HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(Uri.parse(currentStreamUrl)));
} else {
mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(Uri.parse(currentStreamUrl)));
}
2021-01-24 00:31:51 +01:00
// Set the media source to be played.
player.setMediaSource(mediaSource);
// Prepare the player.
player.prepare();
// Auto play
player.setPlayWhenReady(true);
//set playback speed to global default
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
float speed = Float.parseFloat(sharedPref.getString(getString(R.string.pref_video_speed_key), "1.0"));
this.setPlayBackSpeed(speed);
2018-12-24 05:30:32 +01:00
playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
context, PLAYBACK_CHANNEL_ID, R.string.playback_channel_name,
PLAYBACK_NOTIFICATION_ID,
new PlayerNotificationManager.MediaDescriptionAdapter() {
@Override
public String getCurrentContentTitle(Player player) {
return currentVideo.getName();
}
@Nullable
@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);
}
@Override
public String getCurrentContentText(Player player) {
return MetaDataHelper.getMetaString(
currentVideo.getCreatedAt(),
currentVideo.getViews(),
getBaseContext()
);
}
@Nullable
@Override
public Bitmap getCurrentLargeIcon(Player player,
PlayerNotificationManager.BitmapCallback callback) {
return null;
}
}
);
2019-02-16 22:55:24 +01:00
playerNotificationManager.setSmallIcon(R.drawable.ic_logo_bw);
// don't show skip buttons in notification
playerNotificationManager.setUseNavigationActions(false);
2020-06-30 23:56:01 +02:00
playerNotificationManager.setUseStopAction(true);
playerNotificationManager.setNotificationListener(
new PlayerNotificationManager.NotificationListener() {
@Override
public void onNotificationStarted(int notificationId, Notification notification) {
startForeground(notificationId, notification);
}
@Override
public void onNotificationCancelled(int notificationId) {
2018-12-26 15:24:02 +01:00
Log.v(TAG, "onNotificationCancelled...");
2020-07-01 18:04:20 +02:00
stopForeground(true);
Intent killFloat = new Intent(ACTION_STOP);
sendBroadcast(killFloat);
/*
Intent killFloat = new Intent(BROADCAST_ACTION);
2020-06-30 23:56:01 +02:00
Intent killFloatingWindow = new Intent(getApplicationContext(),VideoPlayActivity.class);
killFloatingWindow.putExtra("killFloat",true);
2020-07-01 18:04:20 +02:00
2020-06-30 23:56:01 +02:00
startActivity(killFloatingWindow);
// TODO: only kill the notification if we no longer have a bound activity
stopForeground(true);
2020-07-01 18:04:20 +02:00
*/
}
}
);
playerNotificationManager.setPlayer(player);
// external Media control, Android Wear / Google Home etc.
MediaSessionCompat mediaSession = new MediaSessionCompat(context, MEDIA_SESSION_TAG);
mediaSession.setActive(true);
playerNotificationManager.setMediaSessionToken(mediaSession.getSessionToken());
MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession);
mediaSessionConnector.setQueueNavigator(new TimelineQueueNavigator(mediaSession) {
@Override
public MediaDescriptionCompat getMediaDescription(Player player, int windowIndex) {
return Video.getMediaDescription(context, currentVideo);
}
});
update exoplayer version, and fix code style issue. (#185) * try to fix 'cannot make a new request because the previous response is still open' when login. * Release v1.0.38 (#174) * Translated using Weblate (Italian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/it/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 38.7% (125 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 48.0% (155 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (German) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/de/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Bengali) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Spanish) Currently translated at 42.1% (136 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/es/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Persian) Currently translated at 40.2% (130 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fa/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Russian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * update library and more (#160) * download files with friendly name (not video ID) * Update Picasso library FIX : add extension in downloaded filename. download files with friendly name (not video ID) * Update Gradle Add 0.75x and 1.25x to play speed * Release v1.0.35 * try to fix 'cannot make a new request because the previous response ... ' error (#164) * Translations (#163) * Translated using Weblate (Italian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/it/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 38.7% (125 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 48.0% (155 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (German) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/de/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Bengali) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Spanish) Currently translated at 42.1% (136 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/es/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Persian) Currently translated at 40.2% (130 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fa/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Russian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * update library and more (#160) * download files with friendly name (not video ID) * Update Picasso library FIX : add extension in downloaded filename. download files with friendly name (not video ID) * Update Gradle Add 0.75x and 1.25x to play speed * Release v1.0.35 Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> * try to fix 'cannot make a new request because the previous response is still open' when login. Co-authored-by: Stefan Schüller <sschueller@techdroid.com> Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> * Release 1.0.36 * Translated using Weblate (Arabic) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ar/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Dutch) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/nl/ * Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hant/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Italian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/it/ * Master (#170) * Translations (#163) * Translated using Weblate (Italian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/it/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 38.7% (125 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 48.0% (155 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (German) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/de/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Bengali) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Spanish) Currently translated at 42.1% (136 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/es/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Persian) Currently translated at 40.2% (130 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fa/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Russian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * update library and more (#160) * download files with friendly name (not video ID) * Update Picasso library FIX : add extension in downloaded filename. download files with friendly name (not video ID) * Update Gradle Add 0.75x and 1.25x to play speed * Release v1.0.35 Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> * Release 1.0.36 (#166) * Translated using Weblate (Italian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/it/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 38.7% (125 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 48.0% (155 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (German) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/de/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Bengali) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Spanish) Currently translated at 42.1% (136 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/es/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Persian) Currently translated at 40.2% (130 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fa/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Russian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * update library and more (#160) * download files with friendly name (not video ID) * Update Picasso library FIX : add extension in downloaded filename. download files with friendly name (not video ID) * Update Gradle Add 0.75x and 1.25x to play speed * Release v1.0.35 * try to fix 'cannot make a new request because the previous response ... ' error (#164) * Translations (#163) * Translated using Weblate (Italian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/it/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 38.7% (125 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 48.0% (155 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/zh_Hans/ * Translated using Weblate (German) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/de/ * Translated using Weblate (French) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fr/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Russian) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * Translated using Weblate (Bengali) Currently translated at 99.3% (321 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Spanish) Currently translated at 42.1% (136 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/es/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Persian) Currently translated at 40.2% (130 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/fa/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 99.6% (322 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Bengali) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/bn/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Polish) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/pl/ * Translated using Weblate (Russian) Currently translated at 100.0% (323 of 323 strings) Translation: PeerTube/Android Translate-URL: https://hosted.weblate.org/projects/peertube/android/ru/ * update library and more (#160) * download files with friendly name (not video ID) * Update Picasso library FIX : add extension in downloaded filename. download files with friendly name (not video ID) * Update Gradle Add 0.75x and 1.25x to play speed * Release v1.0.35 Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> * try to fix 'cannot make a new request because the previous response is still open' when login. Co-authored-by: Stefan Schüller <sschueller@techdroid.com> Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> * Release 1.0.36 Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> Co-authored-by: lishoujun <lsjun@aliyun.com> * Adding configuration setting and supporting code to pause playback on back button. (#167) Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> Co-authored-by: lishoujun <lsjun@aliyun.com> Co-authored-by: Don Kimberlin <donkimberlin@hotmail.com> * Making Selecting a search suggestion fill search field (#169) * Adding configuration setting and supporting code to choose language (#168) * Version Bump * Fixed merge issue * Server login (#175) * Release v1.0.38 Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> Co-authored-by: lishoujun <lsjun@aliyun.com> Co-authored-by: Allan Nordhøy <epost@anotheragency.no> Co-authored-by: Don Kimberlin <donkimberlin@hotmail.com> * update exoplayer version, and fix code style issue. Co-authored-by: Stefan Schüller <sschueller@techdroid.com> Co-authored-by: Michael Moroni <michaelmoroni@disroot.org> Co-authored-by: mostkai <admin@pwplayer.com> Co-authored-by: B0pol <bopol@e.email> Co-authored-by: Jeannette L <j.lavoie@net-c.ca> Co-authored-by: Nathan <bonnemainsnathan@gmail.com> Co-authored-by: Mihail Iosilevitch <yosik@tutanota.com> Co-authored-by: anonymous <noreply@weblate.org> Co-authored-by: Oymate <dhruboadittya96@gmail.com> Co-authored-by: Juanro49 <juanrobertogarciasanchez@gmail.com> Co-authored-by: Mostafa Ahangarha <ahangarha@gmail.com> Co-authored-by: Szylu <chipolade@gmail.com> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: jmgfr <13685004+jmgfr@users.noreply.github.com> Co-authored-by: Stefan Schueller <sschueller@nunight.com> Co-authored-by: Allan Nordhøy <epost@anotheragency.no> Co-authored-by: Don Kimberlin <donkimberlin@hotmail.com>
2020-06-27 21:46:13 +02:00
mediaSessionConnector.setPlayer(player);
// Audio Focus
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
.setContentType(C.CONTENT_TYPE_MOVIE)
.build();
player.setAudioAttributes(audioAttributes, true);
}
// pause playback on audio output change
private class BecomingNoisyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(intent.getAction())) {
player.setPlayWhenReady(false);
}
}
}
}