@ -1,3 +1,8 @@
|
||||
### Version 1.0.23 Tag: v1.0.23 (2019-01-06)
|
||||
* Moved video playback into fragment
|
||||
* Added duration to video list
|
||||
* Cleaned up full screen button and activation
|
||||
|
||||
### Version 1.0.22 Tag: v1.0.22 (2019-01-05)
|
||||
* Cleaned up like/dislike
|
||||
* Added video download
|
||||
|
16
README.md
@ -6,9 +6,8 @@
|
||||
</h4>
|
||||
|
||||
<p align="center">
|
||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1545425516.png" alt="screenshot" />
|
||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1545425431.png" alt="screenshot" />
|
||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1545425504.png" alt="screenshot" />
|
||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1546780555.png" alt="screenshot" />
|
||||
<img width="250" src="https://raw.githubusercontent.com/sschueller/peertube-android/develop/Screenshot_1546780637.png" alt="screenshot" />
|
||||
</p>
|
||||
|
||||
## Download
|
||||
@ -27,16 +26,17 @@ Beta Test on Google Play: https://play.google.com/store/apps/details?id=net.schu
|
||||
- [X] Themes / Dark mode
|
||||
- [X] Background playback
|
||||
- [X] NSFW Filter option
|
||||
|
||||
- [X] Authentication / Login
|
||||
- [X] Like/dislike video
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] Video Playback via WebRTC
|
||||
- [ ] Authentication / Login
|
||||
- [ ] Like/dislike video
|
||||
- [ ] Comment video
|
||||
- [ ] Video overlay play and draggable video window
|
||||
- [ ] Comment videos
|
||||
- [ ] Report Videos
|
||||
- [ ] User / Channel Overview Page
|
||||
- [ ] Unit Tests
|
||||
|
||||
- [ ] Lots more missing at this point...
|
||||
|
||||
|
||||
|
BIN
Screenshot1.png
Before Width: | Height: | Size: 114 KiB |
BIN
Screenshot2.jpg
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 843 KiB |
Before Width: | Height: | Size: 725 KiB |
Before Width: | Height: | Size: 585 KiB |
BIN
Screenshot_1546780555.png
Normal file
After Width: | Height: | Size: 614 KiB |
BIN
Screenshot_1546780637.png
Normal file
After Width: | Height: | Size: 440 KiB |
@ -6,8 +6,8 @@ android {
|
||||
applicationId "net.schueller.peertube"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 1022
|
||||
versionName "1.0.22"
|
||||
versionCode 1023
|
||||
versionName "1.0.23"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
ext {
|
||||
libVersions = [
|
||||
|
@ -55,7 +55,7 @@ import retrofit2.Response;
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class AccountActivity extends AppCompatActivity {
|
||||
public class AccountActivity extends CommonActivity {
|
||||
|
||||
|
||||
private static final String TAG = "AccountActivity";
|
||||
@ -104,17 +104,8 @@ public class AccountActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Set theme
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
setTheme(getResources().getIdentifier(
|
||||
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
|
||||
"style",
|
||||
getPackageName())
|
||||
);
|
||||
|
||||
setContentView(R.layout.activity_account);
|
||||
|
||||
|
||||
// Attaching the layout to the toolbar object
|
||||
Toolbar toolbar = findViewById(R.id.tool_bar_user);
|
||||
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
||||
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright 2018 Stefan Schüller <sschueller@techdroid.com>
|
||||
*
|
||||
* License: GPL-3.0+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.schueller.peertube.activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -49,7 +49,7 @@ import retrofit2.Response;
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
public class LoginActivity extends CommonActivity {
|
||||
|
||||
private String TAG = "LoginActivity";
|
||||
|
||||
@ -61,14 +61,6 @@ public class LoginActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Set theme
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
setTheme(getResources().getIdentifier(
|
||||
sharedPref.getString(THEME_PREF_KEY, DEFAULT_THEME),
|
||||
"style",
|
||||
getPackageName())
|
||||
);
|
||||
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
// bind button click
|
||||
|
@ -32,10 +32,8 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
@ -68,9 +66,6 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class VideoListActivity extends CommonActivity {
|
||||
|
||||
private String TAG = "VideoListActivity";
|
||||
|
@ -18,105 +18,41 @@
|
||||
|
||||
package net.schueller.peertube.activity;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.se_bastiaan.torrentstream.StreamStatus;
|
||||
import com.github.se_bastiaan.torrentstream.Torrent;
|
||||
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
||||
import com.github.se_bastiaan.torrentstream.TorrentStream;
|
||||
import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
||||
import com.mikepenz.iconics.Iconics;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
import net.schueller.peertube.fragment.VideoMetaDataFragment;
|
||||
import net.schueller.peertube.fragment.VideoOptionsFragment;
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
import net.schueller.peertube.helper.MetaDataHelper;
|
||||
import net.schueller.peertube.intents.Intents;
|
||||
import net.schueller.peertube.model.Account;
|
||||
import net.schueller.peertube.model.Avatar;
|
||||
import net.schueller.peertube.model.Video;
|
||||
import net.schueller.peertube.network.GetVideoDataService;
|
||||
import net.schueller.peertube.network.RetrofitInstance;
|
||||
import net.schueller.peertube.service.VideoPlayerService;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import net.schueller.peertube.fragment.VideoPlayerFragment;
|
||||
|
||||
import static net.schueller.peertube.helper.Constants.BACKGROUND_PLAY_PREF_KEY;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
|
||||
//import static net.schueller.peertube.helper.Constants.BACKGROUND_PLAY_PREF_KEY;
|
||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||
|
||||
public class VideoPlayActivity extends AppCompatActivity implements VideoRendererEventListener {
|
||||
public class VideoPlayActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "VideoPlayActivity";
|
||||
|
||||
private ProgressBar progressBar;
|
||||
private PlayerView simpleExoPlayerView;
|
||||
private Intent videoPlayerIntent;
|
||||
private Context context = this;
|
||||
private TextView fullscreenButton;
|
||||
private Boolean isFullscreen = false;
|
||||
private TorrentStream torrentStream;
|
||||
boolean mBound = false;
|
||||
VideoPlayerService mService;
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
Log.d(TAG, "onServiceConnected");
|
||||
VideoPlayerService.LocalBinder binder = (VideoPlayerService.LocalBinder) service;
|
||||
mService = binder.getService();
|
||||
|
||||
// 2. Create the player
|
||||
simpleExoPlayerView.setPlayer(mService.player);
|
||||
mBound = true;
|
||||
|
||||
loadVideo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
Log.d(TAG, "onServiceDisconnected");
|
||||
simpleExoPlayerView.setPlayer(null);
|
||||
mBound = false;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -132,95 +68,22 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
|
||||
setContentView(R.layout.activity_video_play);
|
||||
|
||||
progressBar = findViewById(R.id.progress);
|
||||
progressBar.setMax(100);
|
||||
// get video ID
|
||||
Intent intent = getIntent();
|
||||
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
|
||||
Log.v(TAG, "click: " + videoUuid);
|
||||
|
||||
simpleExoPlayerView = new PlayerView(this);
|
||||
simpleExoPlayerView = findViewById(R.id.video_view);
|
||||
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
|
||||
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
|
||||
|
||||
simpleExoPlayerView.setControllerShowTimeoutMs(1000);
|
||||
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
||||
assert videoPlayerFragment != null;
|
||||
videoPlayerFragment.start(videoUuid);
|
||||
|
||||
// Full screen Icon
|
||||
fullscreenButton = findViewById(R.id.exo_fullscreen);
|
||||
fullscreenButton.setText(R.string.video_expand_icon);
|
||||
new Iconics.IconicsBuilder().ctx(this).on(fullscreenButton).build();
|
||||
|
||||
fullscreenButton.setOnClickListener(view -> {
|
||||
Log.d(TAG, "Fullscreen");
|
||||
if (!isFullscreen) {
|
||||
isFullscreen = true;
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
fullscreenButton.setText(R.string.video_compress_icon);
|
||||
} else {
|
||||
isFullscreen = false;
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
fullscreenButton.setText(R.string.video_expand_icon);
|
||||
// if we are in landscape set the video to fullscreen
|
||||
int orientation = this.getResources().getConfiguration().orientation;
|
||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
setOrientation(true);
|
||||
}
|
||||
new Iconics.IconicsBuilder().ctx(this).on(fullscreenButton).build();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void startPlayer()
|
||||
{
|
||||
Util.startForegroundService(context, videoPlayerIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Torrent Playback
|
||||
*
|
||||
* @return torrent stream
|
||||
*/
|
||||
private TorrentStream setupTorrentStream() {
|
||||
|
||||
TorrentOptions torrentOptions = new TorrentOptions.Builder()
|
||||
.saveLocation(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS))
|
||||
.removeFilesAfterStop(true)
|
||||
.build();
|
||||
|
||||
TorrentStream torrentStream = TorrentStream.init(torrentOptions);
|
||||
|
||||
torrentStream.addListener(new TorrentListener() {
|
||||
@Override
|
||||
public void onStreamReady(Torrent torrent) {
|
||||
String videopath = Uri.fromFile(torrent.getVideoFile()).toString();
|
||||
Log.d(TAG, "Ready! torrentStream videopath:" + videopath);
|
||||
mService.setCurrentStreamUrl(videopath);
|
||||
startPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamProgress(Torrent torrent, StreamStatus streamStatus) {
|
||||
if(streamStatus.bufferProgress <= 100 && progressBar.getProgress() < 100 && progressBar.getProgress() != streamStatus.bufferProgress) {
|
||||
//Log.d(TAG, "Progress: " + streamStatus.bufferProgress);
|
||||
progressBar.setProgress(streamStatus.bufferProgress);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamStopped() {
|
||||
Log.d(TAG, "Stopped");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamPrepared(Torrent torrent) {
|
||||
Log.d(TAG, "Prepared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamStarted(Torrent torrent) {
|
||||
Log.d(TAG, "Started");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamError(Torrent torrent, Exception e) {
|
||||
Log.d(TAG, "Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return torrentStream;
|
||||
}
|
||||
|
||||
|
||||
@ -231,145 +94,66 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
TextView nameView = findViewById(R.id.name);
|
||||
TextView videoMetaView = findViewById(R.id.videoMeta);
|
||||
TextView descriptionView = findViewById(R.id.description);
|
||||
|
||||
// Checking the orientation of the screen
|
||||
// Checking the orientation changes of the screen
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
simpleExoPlayerView.setLayoutParams(params);
|
||||
setOrientation(true);
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
setOrientation(false);
|
||||
}
|
||||
}
|
||||
|
||||
nameView.setVisibility(View.GONE);
|
||||
videoMetaView.setVisibility(View.GONE);
|
||||
descriptionView.setVisibility(View.GONE);
|
||||
|
||||
|
||||
private void setOrientation(Boolean isLandscape) {
|
||||
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) fragmentManager.findFragmentById(R.id.video_player_fragment);
|
||||
VideoMetaDataFragment videoMetaFragment = (VideoMetaDataFragment) fragmentManager.findFragmentById(R.id.video_meta_data_fragment);
|
||||
|
||||
if (isLandscape) {
|
||||
assert videoPlayerFragment != null;
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) Objects.requireNonNull(videoPlayerFragment.getView()).getLayoutParams();
|
||||
params.width = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||
params.height = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||
videoPlayerFragment.getView().setLayoutParams(params);
|
||||
|
||||
if (videoMetaFragment != null) {
|
||||
fragmentManager.beginTransaction()
|
||||
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
.hide(videoMetaFragment)
|
||||
.commit();
|
||||
}
|
||||
videoPlayerFragment.setIsFullscreen(true);
|
||||
|
||||
} else {
|
||||
assert videoPlayerFragment != null;
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) Objects.requireNonNull(videoPlayerFragment.getView()).getLayoutParams();
|
||||
params.width = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||
params.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 250, getResources().getDisplayMetrics());
|
||||
videoPlayerFragment.getView().setLayoutParams(params);
|
||||
|
||||
if (videoMetaFragment != null) {
|
||||
fragmentManager.beginTransaction()
|
||||
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
.show(videoMetaFragment)
|
||||
.commit();
|
||||
}
|
||||
videoPlayerFragment.setIsFullscreen(false);
|
||||
}
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) simpleExoPlayerView.getLayoutParams();
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
params.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 250, getResources().getDisplayMetrics());
|
||||
simpleExoPlayerView.setLayoutParams(params);
|
||||
|
||||
nameView.setVisibility(View.VISIBLE);
|
||||
videoMetaView.setVisibility(View.VISIBLE);
|
||||
descriptionView.setVisibility(View.VISIBLE);
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void loadVideo()
|
||||
{
|
||||
// get video ID
|
||||
Intent intent = getIntent();
|
||||
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
|
||||
Log.v(TAG, "click: " + videoUuid);
|
||||
|
||||
// get video details from api
|
||||
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
|
||||
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||
|
||||
Call<Video> call = service.getVideoData(videoUuid);
|
||||
|
||||
call.enqueue(new Callback<Video>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Video> call, @NonNull Response<Video> response) {
|
||||
|
||||
// Toast.makeText(TorrentVideoPlayActivity.this, response.body().getDescription(), Toast.LENGTH_SHORT).show();
|
||||
|
||||
// TODO: remove this code duplication, similar code as in video list rows
|
||||
|
||||
|
||||
Video video = response.body();
|
||||
|
||||
mService.setCurrentVideo(video);
|
||||
|
||||
if (video == null){
|
||||
Toast.makeText(VideoPlayActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
VideoMetaDataFragment videoMetaDataFragment = (VideoMetaDataFragment)
|
||||
getSupportFragmentManager().findFragmentById(R.id.video_meta_data_fragment);
|
||||
|
||||
assert videoMetaDataFragment != null;
|
||||
videoMetaDataFragment.updateVideoMeta(video, mService);
|
||||
|
||||
Log.v(TAG, "url : " + video.getFiles().get(0).getFileUrl());
|
||||
|
||||
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
||||
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
||||
|
||||
String stream = video.getFiles().get(0).getTorrentUrl();
|
||||
Log.v(TAG, "getTorrentUrl : " + video.getFiles().get(0).getTorrentUrl());
|
||||
torrentStream = setupTorrentStream();
|
||||
torrentStream.startStream(stream);
|
||||
} else {
|
||||
startPlayer();
|
||||
}
|
||||
Log.v(TAG,"end of load Video");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Video> call, @NonNull Throwable t) {
|
||||
Log.wtf(TAG, t.fillInStackTrace());
|
||||
Toast.makeText(VideoPlayActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoEnabled(DecoderCounters counters) {
|
||||
Log.v(TAG, "onVideoEnabled()...");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoInputFormatChanged(Format format) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDroppedFrames(int count, long elapsedMs) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderedFirstFrame(Surface surface) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoDisabled(DecoderCounters counters) {
|
||||
Log.v(TAG, "onVideoDisabled()...");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
simpleExoPlayerView.setPlayer(null);
|
||||
if (torrentStream != null){
|
||||
torrentStream.stopStream();
|
||||
}
|
||||
|
||||
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
|
||||
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
|
||||
|
||||
assert videoPlayerFragment != null;
|
||||
videoPlayerFragment.destroyVideo();
|
||||
|
||||
|
||||
super.onDestroy();
|
||||
Log.v(TAG, "onDestroy...");
|
||||
}
|
||||
@ -399,10 +183,12 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
// stopService(new Intent(this, VideoPlayerService.class));
|
||||
// }
|
||||
|
||||
if (mBound) {
|
||||
unbindService(mConnection);
|
||||
mBound = false;
|
||||
}
|
||||
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
|
||||
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
|
||||
|
||||
assert videoPlayerFragment != null;
|
||||
videoPlayerFragment.stopVideo();
|
||||
|
||||
Log.v(TAG, "onStop()...");
|
||||
}
|
||||
|
||||
@ -410,10 +196,6 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if (!mBound) {
|
||||
videoPlayerIntent = new Intent(this, VideoPlayerService.class);
|
||||
bindService(videoPlayerIntent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
Log.v(TAG, "onStart()...");
|
||||
}
|
||||
|
||||
|
@ -85,9 +85,12 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
.into(holder.avatar);
|
||||
}
|
||||
|
||||
|
||||
// set Name
|
||||
holder.name.setText(videoList.get(position).getName());
|
||||
|
||||
// set duration
|
||||
holder.videoDuration.setText( MetaDataHelper.getDuration(videoList.get(position).getDuration().longValue()));
|
||||
|
||||
// set age and view count
|
||||
holder.videoMeta.setText(
|
||||
MetaDataHelper.getMetaString(videoList.get(position).getCreatedAt(),
|
||||
@ -153,7 +156,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
|
||||
class VideoViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView name, videoMeta, videoOwner, moreButton;
|
||||
TextView name, videoMeta, videoOwner, moreButton, videoDuration;
|
||||
ImageView thumb, avatar;
|
||||
View mView;
|
||||
|
||||
@ -165,6 +168,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHol
|
||||
videoMeta = itemView.findViewById(R.id.videoMeta);
|
||||
videoOwner = itemView.findViewById(R.id.videoOwner);
|
||||
moreButton = itemView.findViewById(R.id.moreButton);
|
||||
videoDuration = itemView.findViewById(R.id.video_duration);
|
||||
mView = itemView;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2018 Stefan Schüller <sschueller@techdroid.com>
|
||||
*
|
||||
* License: GPL-3.0+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.schueller.peertube.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
|
@ -50,7 +50,7 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.bottom_sheet_video_options_fragment, container,
|
||||
View view = inflater.inflate(R.layout.fragment_video_options_popup_menu, container,
|
||||
false);
|
||||
|
||||
// Icons
|
||||
|
@ -0,0 +1,353 @@
|
||||
/*
|
||||
* Copyright 2018 Stefan Schüller <sschueller@techdroid.com>
|
||||
*
|
||||
* License: GPL-3.0+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.schueller.peertube.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.se_bastiaan.torrentstream.StreamStatus;
|
||||
import com.github.se_bastiaan.torrentstream.Torrent;
|
||||
import com.github.se_bastiaan.torrentstream.TorrentOptions;
|
||||
import com.github.se_bastiaan.torrentstream.TorrentStream;
|
||||
import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
||||
import com.mikepenz.iconics.Iconics;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
|
||||
import net.schueller.peertube.helper.APIUrlHelper;
|
||||
import net.schueller.peertube.model.Video;
|
||||
import net.schueller.peertube.network.GetVideoDataService;
|
||||
import net.schueller.peertube.network.RetrofitInstance;
|
||||
import net.schueller.peertube.service.VideoPlayerService;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class VideoPlayerFragment extends Fragment implements VideoRendererEventListener {
|
||||
|
||||
private String mVideoUuid;
|
||||
private ProgressBar progressBar;
|
||||
private PlayerView simpleExoPlayerView;
|
||||
private Intent videoPlayerIntent;
|
||||
private Boolean mBound = false;
|
||||
private Boolean isFullscreen = false;
|
||||
private VideoPlayerService mService;
|
||||
private TorrentStream torrentStream;
|
||||
|
||||
private static final String TAG = "VideoPlayerFragment";
|
||||
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
Log.d(TAG, "onServiceConnected");
|
||||
VideoPlayerService.LocalBinder binder = (VideoPlayerService.LocalBinder) service;
|
||||
mService = binder.getService();
|
||||
|
||||
// 2. Create the player
|
||||
simpleExoPlayerView.setPlayer(mService.player);
|
||||
mBound = true;
|
||||
|
||||
loadVideo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
Log.d(TAG, "onServiceDisconnected");
|
||||
simpleExoPlayerView.setPlayer(null);
|
||||
mBound = false;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_video_player, container, false);
|
||||
}
|
||||
|
||||
|
||||
public void start(String videoUuid) {
|
||||
|
||||
// start service
|
||||
Context context = getContext();
|
||||
Activity activity = getActivity();
|
||||
|
||||
mVideoUuid = videoUuid;
|
||||
|
||||
assert activity != null;
|
||||
progressBar = activity.findViewById(R.id.progress);
|
||||
progressBar.setMax(100);
|
||||
|
||||
simpleExoPlayerView = new PlayerView(context);
|
||||
simpleExoPlayerView = activity.findViewById(R.id.video_view);
|
||||
|
||||
simpleExoPlayerView.setControllerShowTimeoutMs(1000);
|
||||
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
||||
|
||||
// Full screen Icon
|
||||
TextView fullscreenButton = activity.findViewById(R.id.exo_fullscreen);
|
||||
fullscreenButton.setText(R.string.video_expand_icon);
|
||||
new Iconics.IconicsBuilder().ctx(context).on(fullscreenButton).build();
|
||||
|
||||
fullscreenButton.setOnClickListener(view -> {
|
||||
Log.d(TAG, "Fullscreen");
|
||||
if (!isFullscreen) {
|
||||
isFullscreen = true;
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
} else {
|
||||
isFullscreen = false;
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
});
|
||||
|
||||
if (!mBound) {
|
||||
videoPlayerIntent = new Intent(context, VideoPlayerService.class);
|
||||
activity.bindService(videoPlayerIntent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void loadVideo() {
|
||||
Context context = getContext();
|
||||
|
||||
|
||||
// get video details from api
|
||||
String apiBaseURL = APIUrlHelper.getUrlWithVersion(context);
|
||||
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||
|
||||
Call<Video> call = service.getVideoData(mVideoUuid);
|
||||
|
||||
call.enqueue(new Callback<Video>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Video> call, @NonNull Response<Video> response) {
|
||||
|
||||
Video video = response.body();
|
||||
|
||||
mService.setCurrentVideo(video);
|
||||
|
||||
if (video == null) {
|
||||
Toast.makeText(context, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
playVideo(video);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Video> call, @NonNull Throwable t) {
|
||||
Log.wtf(TAG, t.fillInStackTrace());
|
||||
Toast.makeText(context, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void playVideo(Video video) {
|
||||
|
||||
Context context = getContext();
|
||||
|
||||
// video Meta fragment
|
||||
assert getFragmentManager() != null;
|
||||
VideoMetaDataFragment videoMetaDataFragment = (VideoMetaDataFragment)
|
||||
getFragmentManager().findFragmentById(R.id.video_meta_data_fragment);
|
||||
|
||||
assert videoMetaDataFragment != null;
|
||||
videoMetaDataFragment.updateVideoMeta(video, mService);
|
||||
|
||||
Log.v(TAG, "url : " + video.getFiles().get(0).getFileUrl());
|
||||
|
||||
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
||||
|
||||
String stream = video.getFiles().get(0).getTorrentUrl();
|
||||
Log.v(TAG, "getTorrentUrl : " + video.getFiles().get(0).getTorrentUrl());
|
||||
torrentStream = setupTorrentStream();
|
||||
torrentStream.startStream(stream);
|
||||
} else {
|
||||
startPlayer();
|
||||
}
|
||||
Log.v(TAG, "end of load Video");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void startPlayer() {
|
||||
Util.startForegroundService(Objects.requireNonNull(getContext()), videoPlayerIntent);
|
||||
}
|
||||
|
||||
|
||||
public void destroyVideo() {
|
||||
simpleExoPlayerView.setPlayer(null);
|
||||
if (torrentStream != null) {
|
||||
torrentStream.stopStream();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopVideo() {
|
||||
|
||||
if (mBound) {
|
||||
Objects.requireNonNull(getContext()).unbindService(mConnection);
|
||||
mBound = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setIsFullscreen(Boolean fullscreen) {
|
||||
isFullscreen = fullscreen;
|
||||
|
||||
TextView fullscreenButton = getActivity().findViewById(R.id.exo_fullscreen);
|
||||
if (fullscreen) {
|
||||
fullscreenButton.setText(R.string.video_compress_icon);
|
||||
} else {
|
||||
fullscreenButton.setText(R.string.video_expand_icon);
|
||||
}
|
||||
new Iconics.IconicsBuilder().ctx(getContext()).on(fullscreenButton).build();
|
||||
}
|
||||
|
||||
public Boolean getIsFullscreen() {
|
||||
return isFullscreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Torrent Playback
|
||||
*
|
||||
* @return torrent stream
|
||||
*/
|
||||
private TorrentStream setupTorrentStream() {
|
||||
|
||||
TorrentOptions torrentOptions = new TorrentOptions.Builder()
|
||||
.saveLocation(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS))
|
||||
.removeFilesAfterStop(true)
|
||||
.build();
|
||||
|
||||
TorrentStream torrentStream = TorrentStream.init(torrentOptions);
|
||||
|
||||
torrentStream.addListener(new TorrentListener() {
|
||||
@Override
|
||||
public void onStreamReady(Torrent torrent) {
|
||||
String videopath = Uri.fromFile(torrent.getVideoFile()).toString();
|
||||
Log.d(TAG, "Ready! torrentStream videopath:" + videopath);
|
||||
mService.setCurrentStreamUrl(videopath);
|
||||
startPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamProgress(Torrent torrent, StreamStatus streamStatus) {
|
||||
if (streamStatus.bufferProgress <= 100 && progressBar.getProgress() < 100 && progressBar.getProgress() != streamStatus.bufferProgress) {
|
||||
//Log.d(TAG, "Progress: " + streamStatus.bufferProgress);
|
||||
progressBar.setProgress(streamStatus.bufferProgress);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamStopped() {
|
||||
Log.d(TAG, "Stopped");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamPrepared(Torrent torrent) {
|
||||
Log.d(TAG, "Prepared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamStarted(Torrent torrent) {
|
||||
Log.d(TAG, "Started");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStreamError(Torrent torrent, Exception e) {
|
||||
Log.d(TAG, "Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return torrentStream;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onVideoEnabled(DecoderCounters counters) {
|
||||
Log.v(TAG, "onVideoEnabled()...");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoInputFormatChanged(Format format) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDroppedFrames(int count, long elapsedMs) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderedFirstFrame(Surface surface) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoDisabled(DecoderCounters counters) {
|
||||
Log.v(TAG, "onVideoDisabled()...");
|
||||
}
|
||||
|
||||
}
|
@ -20,6 +20,9 @@ package net.schueller.peertube.helper;
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import net.schueller.peertube.R;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Period;
|
||||
import java.util.Date;
|
||||
|
||||
public class MetaDataHelper {
|
||||
@ -37,4 +40,7 @@ public class MetaDataHelper {
|
||||
serverHost;
|
||||
}
|
||||
|
||||
public static String getDuration(Long duration) {
|
||||
return DateUtils.formatElapsedTime(duration);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -12,31 +11,16 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/video_view"
|
||||
<fragment android:name="net.schueller.peertube.fragment.VideoPlayerFragment"
|
||||
android:id="@+id/video_player_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:background="@color/videoBackgroundColor"
|
||||
app:controller_layout_id="@layout/video_playback_controls"
|
||||
app:resize_mode="fixed_width"
|
||||
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/video_view"
|
||||
android:indeterminate="false"
|
||||
android:max="100" />
|
||||
android:layout_height="250dp" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/progress"
|
||||
android:layout_below="@id/video_player_fragment"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
|
26
app/src/main/res/layout/fragment_video_player.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/videoBackgroundColor"
|
||||
app:controller_layout_id="@layout/video_playback_controls"
|
||||
app:resize_mode="fixed_width"
|
||||
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="false"
|
||||
android:max="100" />
|
||||
|
||||
</LinearLayout>
|
@ -24,6 +24,19 @@
|
||||
android:maxHeight="300dp"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<TextView
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:layout_margin="2dp"
|
||||
android:text=""
|
||||
android:layout_above="@+id/avatar"
|
||||
android:gravity="bottom|end"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:id="@+id/video_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#000000"/>
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="72dp"
|
||||
|