提交 474815a7 authored 作者: 汪显鹏's avatar 汪显鹏

GSY 多任务播放模式

上级 76b9e47d
......@@ -6,6 +6,7 @@
<application
android:allowBackup="true"
android:appComponentFactory=""
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
......@@ -19,6 +20,10 @@
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
......@@ -28,18 +33,14 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EmptyActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar">
</activity>
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
<activity
android:name=".MainActivity"
......
......@@ -20,6 +20,8 @@ import com.ubains.rtspdemo.vedio.EmptyControlVideo;
import java.util.ArrayList;
import java.util.List;
import tv.danmaku.ijk.media.exo2.Exo2PlayerManager;
import tv.danmaku.ijk.media.exo2.ExoPlayerCacheManager;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public class EmptyActivity extends AppCompatActivity {
......@@ -49,7 +51,7 @@ public class EmptyActivity extends AppCompatActivity {
}
private void init() {
//PlayerFactory.setPlayManager(Exo2PlayerManager.class);
PlayerFactory.setPlayManager(Exo2PlayerManager.class);
//系统内核模式
//PlayerFactory.setPlayManager(SystemPlayerManager.class);
//ijk内核,默认模式 ijk 模式才支持RTSP 播放
......@@ -100,10 +102,9 @@ public class EmptyActivity extends AppCompatActivity {
String url = "rtsp://admin:huawei@123@192.168.11.20/LiveMedia/ch1/Media1";
String ur2 = "rtsp://admin:huawei@123@192.168.11.20/LiveMedia/ch1/Media1";
videoPlayer1.setUp(url, true, "");
videoPlayer2.setUp(ur2, true, "");
// videoPlayer2.setUp(ur2, true, "");
//过渡动画
initTransition();
......
......@@ -66,9 +66,9 @@ public class ListMultiNormalAdapter extends BaseAdapter {
}
// final String url = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
final String url = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
final String url = "rtsp://admin:huawei@123@192.168.11.21/LiveMedia/ch1/Media1";
//final String url = "rtsp://admin:huawei@123@192.168.11.21/LiveMedia/ch1/Media1";
//多个播放时必须在setUpLazy、setUp和getGSYVideoManager()等前面设置
holder.gsyVideoPlayer.setPlayTag(TAG);
......@@ -101,11 +101,11 @@ public class ListMultiNormalAdapter extends BaseAdapter {
holder.gsyVideoPlayer.setNeedLockFull(true);
if (position % 2 == 0) {
holder.gsyVideoPlayer.loadCoverImage(url, R.mipmap.ic_launcher);
} else {
holder.gsyVideoPlayer.loadCoverImage(url, R.mipmap.ic_launcher);
}
// if (position % 2 == 0) {
// holder.gsyVideoPlayer.loadCoverImage(url, R.mipmap.ic_launcher);
// } else {
// holder.gsyVideoPlayer.loadCoverImage(url, R.mipmap.ic_launcher);
// }
holder.gsyVideoPlayer.setVideoAllCallBack(new GSYSampleCallBack() {
......
......@@ -24,7 +24,7 @@ public class MultiSampleVideo extends StandardGSYVideoPlayer {
private final static String TAG = "MultiSampleVideo";
ImageView mCoverImage;
// ImageView mCoverImage;
String mCoverOriginUrl;
......@@ -45,7 +45,7 @@ public class MultiSampleVideo extends StandardGSYVideoPlayer {
@Override
protected void init(Context context) {
super.init(context);
mCoverImage = (ImageView) findViewById(R.id.thumbImage);
// mCoverImage = (ImageView) findViewById(R.id.thumbImage);
if (mThumbImageViewLayout != null &&
(mCurrentState == -1 || mCurrentState == CURRENT_STATE_NORMAL || mCurrentState == CURRENT_STATE_ERROR)) {
mThumbImageViewLayout.setVisibility(VISIBLE);
......@@ -101,28 +101,17 @@ public class MultiSampleVideo extends StandardGSYVideoPlayer {
return R.layout.video_layout_cover;
}
public void loadCoverImage(String url, int res) {
mCoverOriginUrl = url;
mDefaultRes = res;
mCoverImage.setBackgroundResource(res);
// Glide.with(getContext().getApplicationContext())
// .setDefaultRequestOptions(
// new RequestOptions()
// .frame(1000000)
// .centerCrop()
// .error(res)
// .placeholder(res))
// .load(url)
// .into(mCoverImage);
}
// public void loadCoverImage(String url, int res) {
// mCoverOriginUrl = url;
// mDefaultRes = res;
// mCoverImage.setBackgroundResource(res);
// }
@Override
public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionBar, boolean statusBar) {
GSYBaseVideoPlayer gsyBaseVideoPlayer = super.startWindowFullscreen(context, actionBar, statusBar);
MultiSampleVideo multiSampleVideo = (MultiSampleVideo) gsyBaseVideoPlayer;
multiSampleVideo.loadCoverImage(mCoverOriginUrl, mDefaultRes);
// multiSampleVideo.loadCoverImage(mCoverOriginUrl, mDefaultRes);
return multiSampleVideo;
}
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".MutliActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.ubains.rtspdemo.vedio.MultiSampleVideo
android:layout_weight="1"
android:id="@+id/detail_player1"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_rtsp1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.ubains.rtspdemo.vedio.MultiSampleVideo
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/detail_player2"
android:orientation="vertical">
<com.ubains.rtspdemo.vedio.MultiSampleVideo
android:id="@+id/detail_player1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.ubains.rtspdemo.vedio.MultiSampleVideo
android:id="@+id/detail_player3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_rtsp2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<com.ubains.rtspdemo.vedio.MultiSampleVideo
android:id="@+id/detail_player2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.ubains.rtspdemo.vedio.MultiSampleVideo
android:id="@+id/detail_player4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -4,160 +4,12 @@
android:layout_height="match_parent"
android:background="@android:color/black">
<ImageView
android:id="@+id/back_tiny"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="6dp"
android:visibility="gone" />
<ImageView
android:id="@+id/small_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:scaleType="centerInside"
android:src="@drawable/video_small_close"
android:visibility="gone" />
<ImageView
android:id="@+id/lock_screen"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:scaleType="centerInside"
android:src="@drawable/unlock"
android:visibility="gone" />
<LinearLayout
android:id="@+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#99000000"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="invisible">
<ImageView
android:id="@+id/fullscreen"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="16dp"
android:scaleType="center"
android:src="@drawable/video_enlarge" />
<SeekBar
android:id="@+id/progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.0"
android:background="@null"
android:max="100"
android:maxHeight="4dp"
android:minHeight="4dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:progressDrawable="@drawable/video_seek_progress"
android:thumb="@drawable/video_seek_thumb" />
<TextView
android:id="@+id/total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<TextView
android:id="@+id/current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="00:00"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/video_title_bg"
android:gravity="center_vertical">
<ImageView
android:id="@+id/back"
android:layout_width="48dp"
android:layout_height="48dp"
android:paddingLeft="10dp"
android:scaleType="centerInside"
android:src="@drawable/video_back" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
</LinearLayout>
<ProgressBar
android:id="@+id/bottom_progressbar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:layout_alignParentBottom="true"
android:max="100"
android:progressDrawable="@drawable/video_progress" />
<RelativeLayout
<FrameLayout
android:id="@+id/surface_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"></RelativeLayout>
<RelativeLayout
android:id="@+id/thumb"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="#000000"
android:scaleType="fitCenter">
<ImageView
android:id="@+id/thumbImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</RelativeLayout>
<moe.codeest.enviews.ENDownloadView
android:id="@+id/loading"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="invisible" />
android:gravity="center">
</FrameLayout>
<moe.codeest.enviews.ENPlayView
android:id="@+id/start"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论