Bug fixes, code cleanup

This commit is contained in:
Stefan Schueller 2021-01-24 00:31:51 +01:00
parent 51a8a6d838
commit 3730804c8f
18 changed files with 87 additions and 51 deletions

View File

@ -1,3 +1,12 @@
### Version 1.0.53 Tag: v1.0.53 (2021-01-24)
- Making X in pip mode stop background audio properly (@dhk2)
- Adding clear search history option to settings menu (@dhk2)
- Fix no language selected defaults to all video languages
- Updated icon library
- Added buffering indicator to video playback
- Fixed blank video issues on servers offering 0p video.
- Updated translations
### Version 1.0.52 Tag: v1.0.52 (2021-01-17) ### Version 1.0.52 Tag: v1.0.52 (2021-01-17)
- Implemented edit server in server book (@kosharskiy) - Implemented edit server in server book (@kosharskiy)
- Updated translations - Updated translations

View File

@ -109,11 +109,11 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.fragment:fragment-ktx:$fragment_version" implementation "androidx.fragment:fragment-ktx:$fragment_version"
implementation 'de.hdodenhof:circleimageview:3.0.0' implementation 'de.hdodenhof:circleimageview:3.1.0'
// font awesome // font awesome
implementation "com.mikepenz:iconics-core:3.1.0" implementation 'com.mikepenz:iconics-core:5.2.4'
implementation 'com.mikepenz:fontawesome-typeface:5.3.1.1@aar' implementation 'com.mikepenz:fontawesome-typeface:5.9.0.2-kotlin@aar'
// http client / REST // http client / REST
implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.okhttp3:okhttp:4.9.0'
@ -141,10 +141,10 @@ dependencies {
implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer" implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer"
// date formatter // date formatter
implementation 'org.ocpsoft.prettytime:prettytime:4.0.4.Final' implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
// Version comparison // Version comparison
implementation 'org.apache.maven:maven-artifact:3.5.0' implementation 'org.apache.maven:maven-artifact:3.6.3'
// database lib // database lib
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
@ -162,7 +162,7 @@ dependencies {
implementation 'androidx.preference:preference-ktx:1.1.1' implementation 'androidx.preference:preference-ktx:1.1.1'
// testing // testing
testImplementation 'junit:junit:4.13' testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test:runner:1.3.0' androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation "androidx.room:room-testing:$room_version" androidTestImplementation "androidx.room:room-testing:$room_version"

View File

@ -67,6 +67,13 @@
android:exported="false" /> android:exported="false" />
<service android:name=".service.VideoPlayerService" /> <service android:name=".service.VideoPlayerService" />
<receiver android:name="androidx.media.session.MediaButtonReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
</application> </application>
</manifest> </manifest>

View File

@ -24,12 +24,11 @@ import android.view.Menu;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode; import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import net.schueller.peertube.R; import net.schueller.peertube.R;

View File

@ -50,11 +50,10 @@ import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome;
import net.schueller.peertube.R; import net.schueller.peertube.R;
import net.schueller.peertube.adapter.VideoAdapter; import net.schueller.peertube.adapter.VideoAdapter;
import net.schueller.peertube.helper.APIUrlHelper; import net.schueller.peertube.helper.APIUrlHelper;
@ -130,15 +129,15 @@ public class VideoListActivity extends CommonActivity {
// Set an icon in the ActionBar // Set an icon in the ActionBar
menu.findItem(R.id.action_account).setIcon( menu.findItem(R.id.action_account).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle).actionBar()); new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle));
menu.findItem(R.id.action_server_address_book).setIcon( menu.findItem(R.id.action_server_address_book).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_server).actionBar()); new IconicsDrawable(this, FontAwesome.Icon.faw_server));
MenuItem searchMenuItem = menu.findItem(R.id.action_search); MenuItem searchMenuItem = menu.findItem(R.id.action_search);
searchMenuItem.setIcon( searchMenuItem.setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_search).actionBar()); new IconicsDrawable(this, FontAwesome.Icon.faw_search));
// Get the SearchView and set the searchable configuration // Get the SearchView and set the searchable configuration
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
@ -324,13 +323,16 @@ public class VideoListActivity extends CommonActivity {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String nsfw = sharedPref.getBoolean(getString(R.string.pref_show_nsfw_key), false) ? "both" : "false"; String nsfw = sharedPref.getBoolean(getString(R.string.pref_show_nsfw_key), false) ? "both" : "false";
Locale locale = getResources().getConfiguration().locale; //
String country = locale.getLanguage(); // Locale locale = getResources().getConfiguration().locale;
// String country = locale.getLanguage();
//
// HashSet<String> countries = new HashSet<>(1);
// countries.add(country);
HashSet<String> countries = new HashSet<>(1); // We set this to default to null so that on initial start there are videos listed.
countries.add(country); Set<String> languages = sharedPref.getStringSet(getString(R.string.pref_video_language_key), null);
Set<String> languages = sharedPref.getStringSet(getString(R.string.pref_video_language_key), countries);
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this); String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL, APIUrlHelper.useInsecureConnection(this)).create(GetVideoDataService.class); GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL, APIUrlHelper.useInsecureConnection(this)).create(GetVideoDataService.class);

View File

@ -115,7 +115,7 @@ public class ChannelAdapter extends RecyclerView.Adapter<ChannelAdapter.AccountV
}); });
holder.moreButton.setText(R.string.video_more_icon); holder.moreButton.setText(R.string.video_more_icon);
new Iconics.IconicsBuilder().ctx(context).on(holder.moreButton).build(); new Iconics.Builder().on(holder.moreButton).build();
holder.moreButton.setOnClickListener(v -> { holder.moreButton.setOnClickListener(v -> {

View File

@ -119,7 +119,7 @@ public class ServerSearchAdapter extends RecyclerView.Adapter<ServerSearchAdapte
// //
// //
// holder.moreButton.setText(R.string.video_more_icon); // holder.moreButton.setText(R.string.video_more_icon);
// new Iconics.IconicsBuilder().ctx(context).on(holder.moreButton).build(); // new Iconics.Builder().on(holder.moreButton).build();
// //
// holder.moreButton.setOnClickListener(v -> { // holder.moreButton.setOnClickListener(v -> {
// //

View File

@ -131,7 +131,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
}); });
holder.moreButton.setText(R.string.video_more_icon); holder.moreButton.setText(R.string.video_more_icon);
new Iconics.IconicsBuilder().ctx(context).on(holder.moreButton).build(); new Iconics.Builder().on(holder.moreButton).build();
holder.moreButton.setOnClickListener(v -> { holder.moreButton.setOnClickListener(v -> {

View File

@ -52,9 +52,9 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
if (autoQualityFile == null) { if (autoQualityFile == null) {
autoQualityFile = new File(); autoQualityFile = new File();
Resolution autoQualityResolution = new Resolution(); Resolution autoQualityResolution = new Resolution();
autoQualityResolution.setId(0); autoQualityResolution.setId(999999);
autoQualityResolution.setLabel(context.getString(R.string.menu_video_options_quality_automated)); autoQualityResolution.setLabel(context.getString(R.string.menu_video_options_quality_automated));
autoQualityFile.setId(0); autoQualityFile.setId(999999);
autoQualityFile.setResolution(autoQualityResolution); autoQualityFile.setResolution(autoQualityResolution);
} }
if (!mFiles.contains(autoQualityFile)) { if (!mFiles.contains(autoQualityFile)) {
@ -74,7 +74,7 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
false); false);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 0); Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 999999);
for (File file : mFiles) { for (File file : mFiles) {
@ -95,11 +95,13 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
for (File fileV : mFiles) { for (File fileV : mFiles) {
TextView iconViewV = view.findViewById(fileV.getResolution().getId()); TextView iconViewV = view.findViewById(fileV.getResolution().getId());
iconViewV.setText(""); if (iconViewV != null) {
iconViewV.setText("");
}
} }
iconView.setText(R.string.video_quality_active_icon); iconView.setText(R.string.video_quality_active_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build(); new Iconics.Builder().on(iconView).build();
//TODO: set new video quality on running video //TODO: set new video quality on running video
@ -112,7 +114,7 @@ public class VideoMenuQualityFragment extends BottomSheetDialogFragment {
// Set current // Set current
if (videoQuality.equals(file.getResolution().getId())) { if (videoQuality.equals(file.getResolution().getId())) {
iconView.setText(R.string.video_quality_active_icon); iconView.setText(R.string.video_quality_active_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build(); new Iconics.Builder().on(iconView).build();
} }
} }

View File

@ -100,7 +100,7 @@ public class VideoMenuSpeedFragment extends BottomSheetDialogFragment {
videoPlayerService.setPlayBackSpeed(speed); videoPlayerService.setPlayBackSpeed(speed);
icon.setText(R.string.video_speed_active_icon); icon.setText(R.string.video_speed_active_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(icon).build(); new Iconics.Builder().on(icon).build();
} }
} }

View File

@ -105,7 +105,7 @@ public class VideoMetaDataFragment extends Fragment {
Button thumbsUpButton = activity.findViewById(R.id.video_thumbs_up); Button thumbsUpButton = activity.findViewById(R.id.video_thumbs_up);
defaultTextColor = thumbsUpButton.getTextColors(); defaultTextColor = thumbsUpButton.getTextColors();
thumbsUpButton.setText(R.string.video_thumbs_up_icon); thumbsUpButton.setText(R.string.video_thumbs_up_icon);
new Iconics.IconicsBuilder().ctx(context).on(thumbsUpButton).build(); new Iconics.Builder().on(thumbsUpButton).build();
thumbsUpButton.setOnClickListener(v -> { thumbsUpButton.setOnClickListener(v -> {
rateVideo(true, video); rateVideo(true, video);
}); });
@ -113,7 +113,7 @@ public class VideoMetaDataFragment extends Fragment {
// Thumbs Down // Thumbs Down
Button thumbsDownButton = activity.findViewById(R.id.video_thumbs_down); Button thumbsDownButton = activity.findViewById(R.id.video_thumbs_down);
thumbsDownButton.setText(R.string.video_thumbs_down_icon); thumbsDownButton.setText(R.string.video_thumbs_down_icon);
new Iconics.IconicsBuilder().ctx(context).on(thumbsDownButton).build(); new Iconics.Builder().on(thumbsDownButton).build();
thumbsDownButton.setOnClickListener(v -> { thumbsDownButton.setOnClickListener(v -> {
rateVideo(false, video); rateVideo(false, video);
}); });
@ -145,7 +145,7 @@ public class VideoMetaDataFragment extends Fragment {
// Share // Share
Button videoShareButton = activity.findViewById(R.id.video_share); Button videoShareButton = activity.findViewById(R.id.video_share);
videoShareButton.setText(R.string.video_share_icon); videoShareButton.setText(R.string.video_share_icon);
new Iconics.IconicsBuilder().ctx(context).on(videoShareButton).build(); new Iconics.Builder().on(videoShareButton).build();
videoShareButton.setOnClickListener(v -> videoShareButton.setOnClickListener(v ->
{ {
leaveAppExpected = true; leaveAppExpected = true;
@ -155,7 +155,7 @@ public class VideoMetaDataFragment extends Fragment {
// Download // Download
Button videoDownloadButton = activity.findViewById(R.id.video_download); Button videoDownloadButton = activity.findViewById(R.id.video_download);
videoDownloadButton.setText(R.string.video_download_icon); videoDownloadButton.setText(R.string.video_download_icon);
new Iconics.IconicsBuilder().ctx(context).on(videoDownloadButton).build(); new Iconics.Builder().on(videoDownloadButton).build();
videoDownloadButton.setOnClickListener(v -> { videoDownloadButton.setOnClickListener(v -> {
// get permission to store file // get permission to store file
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
@ -235,7 +235,7 @@ public class VideoMetaDataFragment extends Fragment {
// more button // more button
TextView moreButton = activity.findViewById(R.id.moreButton); TextView moreButton = activity.findViewById(R.id.moreButton);
moreButton.setText(R.string.video_more_icon); moreButton.setText(R.string.video_more_icon);
new Iconics.IconicsBuilder().ctx(context).on(moreButton).build(); new Iconics.Builder().on(moreButton).build();
moreButton.setOnClickListener(v -> { moreButton.setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(context, v); PopupMenu popup = new PopupMenu(context, v);
@ -260,7 +260,7 @@ public class VideoMetaDataFragment extends Fragment {
// video player options // video player options
TextView videoOptions = activity.findViewById(R.id.exo_more); TextView videoOptions = activity.findViewById(R.id.exo_more);
videoOptions.setText(R.string.video_more_icon); videoOptions.setText(R.string.video_more_icon);
new Iconics.IconicsBuilder().ctx(context).on(videoOptions).build(); new Iconics.Builder().on(videoOptions).build();
videoOptions.setOnClickListener(v -> { videoOptions.setOnClickListener(v -> {
VideoOptionsFragment videoOptionsFragment = VideoOptionsFragment videoOptionsFragment =

View File

@ -77,7 +77,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
iconView.setText(R.string.video_option_speed_icon); iconView.setText(R.string.video_option_speed_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(iconView).build(); new Iconics.Builder().on(iconView).build();
textView.setOnClickListener(view1 -> { textView.setOnClickListener(view1 -> {
VideoMenuSpeedFragment videoMenuSpeedFragment = VideoMenuSpeedFragment videoMenuSpeedFragment =
VideoMenuSpeedFragment.newInstance(videoPlayerService); VideoMenuSpeedFragment.newInstance(videoPlayerService);
@ -92,7 +92,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
TextView textView2 = menuRow2.findViewById(R.id.video_quality_text); TextView textView2 = menuRow2.findViewById(R.id.video_quality_text);
textView2.setText(String.format(getString(R.string.menu_video_options_quality), getCurrentVideoQuality(files))); textView2.setText(String.format(getString(R.string.menu_video_options_quality), getCurrentVideoQuality(files)));
iconView2.setText(R.string.video_option_quality_icon); iconView2.setText(R.string.video_option_quality_icon);
new Iconics.IconicsBuilder().ctx(getContext()).on(iconView2).build(); new Iconics.Builder().on(iconView2).build();
textView2.setOnClickListener(view1 -> { textView2.setOnClickListener(view1 -> {
VideoMenuQualityFragment videoMenuQualityFragment = VideoMenuQualityFragment videoMenuQualityFragment =
VideoMenuQualityFragment.newInstance(getContext(), files); VideoMenuQualityFragment.newInstance(getContext(), files);
@ -107,7 +107,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
private String getCurrentVideoQuality(ArrayList<File> files) { private String getCurrentVideoQuality(ArrayList<File> files) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 0); Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 999999);
for (File file : files) { for (File file : files) {
if (videoQuality.equals(file.getResolution().getId())) { if (videoQuality.equals(file.getResolution().getId())) {

View File

@ -162,7 +162,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
FrameLayout fullscreenButton = activity.findViewById(R.id.exo_fullscreen_button); FrameLayout fullscreenButton = activity.findViewById(R.id.exo_fullscreen_button);
fullscreenText.setText(R.string.video_expand_icon); fullscreenText.setText(R.string.video_expand_icon);
new Iconics.IconicsBuilder().ctx(context).on(fullscreenText).build(); new Iconics.Builder().on(fullscreenText).build();
fullscreenButton.setOnClickListener(view -> { fullscreenButton.setOnClickListener(view -> {
Log.d(TAG, "Fullscreen"); Log.d(TAG, "Fullscreen");
@ -239,12 +239,12 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
torrentStream.startStream(stream); torrentStream.startStream(stream);
} else { } else {
Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 0); Integer videoQuality = sharedPref.getInt(getString(R.string.pref_quality_key), 999999);
//get video qualities // get video qualities
/// # // TODO: if auto is set all versions except 0p should be added to a track and have exoplayer auto select optimal bitrate
if (video.getFiles().size() > 0) { if (video.getFiles().size() > 0) {
String urlToPlay = video.getFiles().get( 0 ).getFileUrl(); String urlToPlay = video.getFiles().get( 0 ).getFileUrl(); // default, take first found, usually highest res
for ( File file : video.getFiles() ) { for ( File file : video.getFiles() ) {
// Set quality if it matches // Set quality if it matches
if ( file.getResolution().getId().equals( videoQuality ) ) { if ( file.getResolution().getId().equals( videoQuality ) ) {
@ -321,7 +321,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
} else { } else {
fullscreenButton.setText(R.string.video_expand_icon); fullscreenButton.setText(R.string.video_expand_icon);
} }
new Iconics.IconicsBuilder().ctx(getContext()).on(fullscreenButton).build(); new Iconics.Builder().on(fullscreenButton).build();
} }
public Boolean getIsFullscreen() { public Boolean getIsFullscreen() {

View File

@ -44,6 +44,7 @@ import android.widget.Toast;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
@ -53,6 +54,8 @@ import com.google.android.exoplayer2.ext.mediasession.TimelineQueueNavigator;
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource; import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource;
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory; import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSourceFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.ui.PlayerNotificationManager; import com.google.android.exoplayer2.ui.PlayerNotificationManager;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
@ -102,7 +105,9 @@ public class VideoPlayerService extends Service {
super.onCreate(); super.onCreate();
player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), new DefaultTrackSelector()); player = new SimpleExoPlayer.Builder(getApplicationContext())
.setTrackSelector(new DefaultTrackSelector(getApplicationContext()))
.build();
// Stop player if audio device changes, e.g. headphones unplugged // Stop player if audio device changes, e.g. headphones unplugged
player.addListener(new Player.EventListener() { player.addListener(new Player.EventListener() {
@ -224,14 +229,18 @@ public class VideoPlayerService extends Service {
okhttpClientBuilder = getUnsafeOkHttpClientBuilder(); okhttpClientBuilder = getUnsafeOkHttpClientBuilder();
} }
// Create a data source factory.
DataSource.Factory dataSourceFactory = new OkHttpDataSourceFactory(okhttpClientBuilder.build(), Util.getUserAgent(getApplicationContext(), "PeerTube")); DataSource.Factory dataSourceFactory = new OkHttpDataSourceFactory(okhttpClientBuilder.build(), Util.getUserAgent(getApplicationContext(), "PeerTube"));
// This is the MediaSource representing the media to be played. // Create a progressive media source pointing to a stream uri.
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory) MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(Uri.parse(currentStreamUrl)); .createMediaSource(MediaItem.fromUri(Uri.parse(currentStreamUrl)));
// Prepare the player with the source. // Set the media source to be played.
player.prepare(videoSource); player.setMediaSource(mediaSource);
// Prepare the player.
player.prepare();
// Auto play // Auto play
player.setPlayWhenReady(true); player.setPlayWhenReady(true);

View File

@ -13,7 +13,7 @@
android:background="@color/videoBackgroundColor" android:background="@color/videoBackgroundColor"
app:controller_layout_id="@layout/video_playback_controls" app:controller_layout_id="@layout/video_playback_controls"
app:resize_mode="fixed_width" app:resize_mode="fixed_width"
app:show_buffering="always"
/> />

View File

@ -39,6 +39,7 @@
app:iconSpaceReserved="false"/> app:iconSpaceReserved="false"/>
<MultiSelectListPreference <MultiSelectListPreference
app:defaultValue="@array/empty_array"
app:entries="@array/languageArray" app:entries="@array/languageArray"
app:entryValues="@array/languageValues" app:entryValues="@array/languageValues"
app:key="@string/pref_video_language_key" app:key="@string/pref_video_language_key"

View File

@ -9,7 +9,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.1' classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

View File

@ -0,0 +1,7 @@
- Making X in pip mode stop background audio properly (@dhk2)
- Adding clear search history option to settings menu (@dhk2)
- Fix no language selected defaults to all video languages
- Updated icon library
- Added buffering indicator to video playback
- Fixed blank video issues on servers offering 0p video.
- Updated translations