Exoplayer fullscreen
This commit is contained in:
parent
949e8cbc5a
commit
8111b85efb
|
@ -17,6 +17,8 @@ package fr.gouv.etalab.mastodon.activities;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -32,12 +34,13 @@ import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.widget.AppCompatImageView;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.Pair;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -45,7 +48,9 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
@ -58,12 +63,20 @@ import com.github.se_bastiaan.torrentstream.Torrent;
|
||||||
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
||||||
import com.github.se_bastiaan.torrentstream.TorrentStream;
|
import com.github.se_bastiaan.torrentstream.TorrentStream;
|
||||||
import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;
|
import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;
|
||||||
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlayerFactory;
|
import com.google.android.exoplayer2.ExoPlayerFactory;
|
||||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||||
import com.google.android.exoplayer2.source.ExtractorMediaSource;
|
import com.google.android.exoplayer2.source.ExtractorMediaSource;
|
||||||
|
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
|
||||||
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
|
import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
|
||||||
|
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||||
import com.google.android.exoplayer2.ui.PlayerView;
|
import com.google.android.exoplayer2.ui.PlaybackControlView;
|
||||||
|
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
||||||
|
import com.google.android.exoplayer2.ui.TrackSelectionView;
|
||||||
import com.google.android.exoplayer2.upstream.DataSource;
|
import com.google.android.exoplayer2.upstream.DataSource;
|
||||||
|
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
|
||||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
|
||||||
|
@ -92,7 +105,6 @@ import fr.gouv.etalab.mastodon.client.TLSSocketFactory;
|
||||||
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||||
import fr.gouv.etalab.mastodon.helper.FullScreenMediaController;
|
import fr.gouv.etalab.mastodon.helper.FullScreenMediaController;
|
||||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
import fr.gouv.etalab.mastodon.helper.NotificationPanel;
|
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
|
||||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrievePeertubeInterface;
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrievePeertubeInterface;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.PeertubeFavoritesDAO;
|
import fr.gouv.etalab.mastodon.sqlite.PeertubeFavoritesDAO;
|
||||||
|
@ -108,7 +120,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.manageDownloads;
|
||||||
* Peertube activity
|
* Peertube activity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PeertubeActivity extends BaseActivity implements OnRetrievePeertubeInterface, OnPostActionInterface {
|
public class PeertubeActivity extends BaseActivity implements View.OnClickListener, OnRetrievePeertubeInterface, OnPostActionInterface {
|
||||||
|
|
||||||
private String peertubeInstance, videoId;
|
private String peertubeInstance, videoId;
|
||||||
private FullScreenMediaController.fullscreen fullscreen;
|
private FullScreenMediaController.fullscreen fullscreen;
|
||||||
|
@ -120,12 +132,15 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private Peertube peertube;
|
private Peertube peertube;
|
||||||
private TextView toolbar_title;
|
private TextView toolbar_title;
|
||||||
public static String video_id;
|
public static String video_id;
|
||||||
private NotificationPanel nPanel;
|
|
||||||
private TorrentStream torrentStream;
|
private TorrentStream torrentStream;
|
||||||
private TorrentListener torrentListener;
|
private TorrentListener torrentListener;
|
||||||
private PlayerView playerView;
|
private SimpleExoPlayerView playerView;
|
||||||
private SimpleExoPlayer player;
|
private SimpleExoPlayer player;
|
||||||
|
private boolean fullScreenMode;
|
||||||
|
private Dialog fullScreenDialog;
|
||||||
|
private AppCompatImageView fullScreenIcon;
|
||||||
|
private LinearLayout debugRootView;
|
||||||
|
private DefaultTrackSelector trackSelector;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -146,7 +161,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
default:
|
default:
|
||||||
setTheme(R.style.AppThemeDark);
|
setTheme(R.style.AppThemeDark);
|
||||||
}
|
}
|
||||||
|
fullScreenMode = false;
|
||||||
setContentView(R.layout.activity_peertube);
|
setContentView(R.layout.activity_peertube);
|
||||||
loader = findViewById(R.id.loader);
|
loader = findViewById(R.id.loader);
|
||||||
peertube_view_count = findViewById(R.id.peertube_view_count);
|
peertube_view_count = findViewById(R.id.peertube_view_count);
|
||||||
|
@ -160,14 +175,15 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
peertube_information_container = findViewById(R.id.peertube_information_container);
|
peertube_information_container = findViewById(R.id.peertube_information_container);
|
||||||
|
|
||||||
|
|
||||||
|
debugRootView = findViewById(R.id.controls_root);
|
||||||
|
|
||||||
playerView = new PlayerView(this);
|
|
||||||
playerView = findViewById(R.id.media_video);
|
playerView = findViewById(R.id.media_video);
|
||||||
|
|
||||||
playerView.setControllerShowTimeoutMs(1000);
|
playerView.setControllerShowTimeoutMs(1000);
|
||||||
playerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
playerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
||||||
|
|
||||||
|
initFullscreenDialog();
|
||||||
|
initFullscreenButton();
|
||||||
loader.setVisibility(View.VISIBLE);
|
loader.setVisibility(View.VISIBLE);
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
if(b != null) {
|
if(b != null) {
|
||||||
|
@ -400,9 +416,23 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
.removeFilesAfterStop(true)
|
.removeFilesAfterStop(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this);
|
|
||||||
|
|
||||||
|
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
|
||||||
|
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
|
||||||
|
trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
|
||||||
|
|
||||||
|
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(),
|
||||||
|
Util.getUserAgent(getApplicationContext(), "Mastalab"), null);
|
||||||
|
|
||||||
|
ExtractorMediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
|
||||||
|
.createMediaSource(Uri.parse(apiResponse.getPeertubes().get(0).getTorrentUrl(null)));
|
||||||
|
|
||||||
|
|
||||||
|
player = ExoPlayerFactory.newSimpleInstance(PeertubeActivity.this, trackSelector);
|
||||||
playerView.setPlayer(player);
|
playerView.setPlayer(player);
|
||||||
torrentStream = TorrentStream.init(torrentOptions);
|
torrentStream = TorrentStream.init(torrentOptions);
|
||||||
|
player.prepare(videoSource);
|
||||||
torrentStream.startStream(apiResponse.getPeertubes().get(0).getTorrentUrl(null));
|
torrentStream.startStream(apiResponse.getPeertubes().get(0).getTorrentUrl(null));
|
||||||
torrentListener = new TorrentListener() {
|
torrentListener = new TorrentListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -425,7 +455,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
Log.v(Helper.TAG,"onStreamReady");
|
Log.v(Helper.TAG,"onStreamReady");
|
||||||
loader.setVisibility(View.GONE);
|
loader.setVisibility(View.GONE);
|
||||||
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(),
|
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(),
|
||||||
Util.getUserAgent(getApplicationContext(), "Mastalab"), null);
|
Util.getUserAgent(getApplicationContext(), "Mastalab"), bandwidthMeter);
|
||||||
|
|
||||||
ExtractorMediaSource extractorMediaSource = new ExtractorMediaSource.Factory(dataSourceFactory)
|
ExtractorMediaSource extractorMediaSource = new ExtractorMediaSource.Factory(dataSourceFactory)
|
||||||
.createMediaSource(Uri.fromFile(torrent.getVideoFile()));
|
.createMediaSource(Uri.fromFile(torrent.getVideoFile()));
|
||||||
|
@ -521,17 +551,19 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
openFullscreenDialog();
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
|
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
|
||||||
|
closeFullscreenDialog();
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
||||||
}
|
}
|
||||||
change();
|
change();
|
||||||
fullScreenMediaController.changeIcon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -565,8 +597,8 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onDestroy() {
|
||||||
super.onStop();
|
super.onDestroy();
|
||||||
if( torrentStream != null && torrentStream.isStreaming())
|
if( torrentStream != null && torrentStream.isStreaming())
|
||||||
torrentStream.stopStream();
|
torrentStream.stopStream();
|
||||||
}
|
}
|
||||||
|
@ -574,16 +606,18 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
player.release();
|
if( player != null) {
|
||||||
nPanel = new NotificationPanel(PeertubeActivity.this);
|
player.setPlayWhenReady(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume(){
|
public void onResume(){
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if( nPanel != null)
|
if( player != null) {
|
||||||
nPanel.notificationCancel();
|
player.setPlayWhenReady(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayResolution(){
|
public void displayResolution(){
|
||||||
|
@ -666,6 +700,76 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Log.v(Helper.TAG,"view.getParent(): " + view.getParent());
|
||||||
|
Log.v(Helper.TAG,"debugRootView: " + debugRootView);
|
||||||
|
if (view.getParent() == debugRootView) {
|
||||||
|
MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
|
||||||
|
if (mappedTrackInfo != null) {
|
||||||
|
CharSequence title = ((Button) view).getText();
|
||||||
|
int rendererIndex = (int) view.getTag();
|
||||||
|
int rendererType = mappedTrackInfo.getRendererType(rendererIndex);
|
||||||
|
boolean allowAdaptiveSelections =
|
||||||
|
rendererType == C.TRACK_TYPE_VIDEO
|
||||||
|
|| (rendererType == C.TRACK_TYPE_AUDIO
|
||||||
|
&& mappedTrackInfo.getTypeSupport(C.TRACK_TYPE_VIDEO)
|
||||||
|
== MappingTrackSelector.MappedTrackInfo.RENDERER_SUPPORT_NO_TRACKS);
|
||||||
|
Pair<AlertDialog, TrackSelectionView> dialogPair =
|
||||||
|
TrackSelectionView.getDialog(this, title, trackSelector, rendererIndex);
|
||||||
|
dialogPair.second.setShowDisableOption(true);
|
||||||
|
dialogPair.second.setAllowAdaptiveSelections(allowAdaptiveSelections);
|
||||||
|
dialogPair.first.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initFullscreenDialog() {
|
||||||
|
|
||||||
|
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (fullScreenMode)
|
||||||
|
closeFullscreenDialog();
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openFullscreenDialog() {
|
||||||
|
|
||||||
|
((ViewGroup) playerView.getParent()).removeView(playerView);
|
||||||
|
fullScreenDialog.addContentView(playerView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
fullScreenIcon.setImageDrawable(ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_fullscreen_exit));
|
||||||
|
fullScreenMode = true;
|
||||||
|
fullScreenDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void closeFullscreenDialog() {
|
||||||
|
|
||||||
|
((ViewGroup) playerView.getParent()).removeView(playerView);
|
||||||
|
((FrameLayout) findViewById(R.id.main_media_frame)).addView(playerView);
|
||||||
|
fullScreenMode = false;
|
||||||
|
fullScreenDialog.dismiss();
|
||||||
|
fullScreenIcon.setImageDrawable(ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_fullscreen));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initFullscreenButton() {
|
||||||
|
|
||||||
|
PlaybackControlView controlView = playerView.findViewById(R.id.exo_controller);
|
||||||
|
fullScreenIcon = controlView.findViewById(R.id.exo_fullscreen_icon);
|
||||||
|
View fullScreenButton = controlView.findViewById(R.id.exo_fullscreen_button);
|
||||||
|
fullScreenButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (!fullScreenMode)
|
||||||
|
openFullscreenDialog();
|
||||||
|
else
|
||||||
|
closeFullscreenDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void changeColor(){
|
private void changeColor(){
|
||||||
if( peertube.getMyRating() != null && peertube.getMyRating().equals("like")){
|
if( peertube.getMyRating() != null && peertube.getMyRating().equals("like")){
|
||||||
changeDrawableColor(getApplicationContext(), R.drawable.ic_thumb_up_peertube,R.color.positive_thumbs);
|
changeDrawableColor(getApplicationContext(), R.drawable.ic_thumb_up_peertube,R.color.positive_thumbs);
|
||||||
|
|
|
@ -32,16 +32,25 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
<com.google.android.exoplayer2.ui.PlayerView
|
<FrameLayout
|
||||||
android:id="@+id/media_video"
|
android:id="@+id/main_media_frame"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:background="#000000">
|
||||||
|
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
|
||||||
|
android:id="@+id/media_video"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/loader"
|
android:id="@+id/loader"
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2016 The Android Open Source Project
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:layoutDirection="ltr"
|
||||||
|
android:background="#CC000000"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:targetApi="28">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_prev"
|
||||||
|
style="@style/ExoMediaButton.Previous"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_rew"
|
||||||
|
style="@style/ExoMediaButton.Rewind"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_shuffle"
|
||||||
|
style="@style/ExoMediaButton.Shuffle"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_repeat_toggle"
|
||||||
|
style="@style/ExoMediaButton"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_play"
|
||||||
|
style="@style/ExoMediaButton.Play"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_pause"
|
||||||
|
style="@style/ExoMediaButton.Pause"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_ffwd"
|
||||||
|
style="@style/ExoMediaButton.FastForward"/>
|
||||||
|
|
||||||
|
<ImageButton android:id="@id/exo_next"
|
||||||
|
style="@style/ExoMediaButton.Next"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView android:id="@id/exo_position"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="#FFBEBEBE"/>
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.DefaultTimeBar
|
||||||
|
android:id="@id/exo_progress"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="26dp"/>
|
||||||
|
|
||||||
|
<TextView android:id="@id/exo_duration"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="#FFBEBEBE"/>
|
||||||
|
<FrameLayout android:id="@+id/exo_fullscreen_button"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/exo_fullscreen_icon"
|
||||||
|
android:layout_width="18dp"
|
||||||
|
android:layout_height="18dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:contentDescription="@string/fullscreen"
|
||||||
|
android:src="@drawable/ic_fullscreen"/>
|
||||||
|
</FrameLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2016 The Android Open Source Project
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout android:id="@id/exo_content_frame"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<!-- Video surface will be inserted as the first child of the content frame. -->
|
||||||
|
|
||||||
|
<View android:id="@id/exo_shutter"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/black"/>
|
||||||
|
|
||||||
|
<ImageView android:id="@id/exo_artwork"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitXY"/>
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.SubtitleView android:id="@id/exo_subtitles"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<ProgressBar android:id="@id/exo_buffering"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
|
||||||
|
<TextView android:id="@id/exo_error_message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@color/exo_error_message_background_color"
|
||||||
|
android:padding="16dp"/>
|
||||||
|
|
||||||
|
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout android:id="@id/exo_overlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.PlaybackControlView
|
||||||
|
android:id="@id/exo_controller"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<View android:id="@id/exo_controller_placeholder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</merge>
|
|
@ -796,6 +796,7 @@
|
||||||
<string name="reply">Reply</string>
|
<string name="reply">Reply</string>
|
||||||
<string name="delete_comment">Delete a comment</string>
|
<string name="delete_comment">Delete a comment</string>
|
||||||
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
<string name="delete_comment_confirm">Are you sure to delete this comment?</string>
|
||||||
|
<string name="fullscreen">Full screen video</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue