Skip to content

Commit

Permalink
更新demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajunhui committed Mar 11, 2020
1 parent a1cae28 commit d18a7c0
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<activity
android:name=".ui.TestPlayActivity"
android:exported="true"/>
<activity android:name=".ui.MultiPlayActivity" />
</application>

</manifest>
5 changes: 5 additions & 0 deletions app/src/main/java/com/kk/taurus/avplayer/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.widget.TextView;

import com.kk.taurus.avplayer.ui.InputUrlPlayActivity;
import com.kk.taurus.avplayer.ui.MultiPlayActivity;
import com.kk.taurus.avplayer.ui.ViewPagerPlayActivity;
import com.kk.taurus.avplayer.ui.listplay.MultiListActivity;
import com.kk.taurus.avplayer.ui.ShareAnimationActivityA;
Expand Down Expand Up @@ -91,6 +92,10 @@ public void useFloatWindow(View view){
intentTo(FloatWindowActivity.class);
}

public void multiVideoPlay(View view){
intentTo(MultiPlayActivity.class);
}

public void viewPagerPlay(View view){
intentTo(ViewPagerPlayActivity.class);
}
Expand Down
76 changes: 76 additions & 0 deletions app/src/main/java/com/kk/taurus/avplayer/ui/MultiPlayActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.kk.taurus.avplayer.ui;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.kk.taurus.avplayer.R;
import com.kk.taurus.avplayer.play.ReceiverGroupManager;
import com.kk.taurus.playerbase.assist.OnVideoViewEventHandler;
import com.kk.taurus.playerbase.entity.DataSource;
import com.kk.taurus.playerbase.widget.BaseVideoView;

public class MultiPlayActivity extends AppCompatActivity {

BaseVideoView mVideoView01,mVideoView02,mVideoView03,mVideoView04,mVideoView05,mVideoView06;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multi_play);
mVideoView01 = findViewById(R.id.videoView01);
mVideoView02 = findViewById(R.id.videoView02);
mVideoView03 = findViewById(R.id.videoView03);
mVideoView04 = findViewById(R.id.videoView04);
mVideoView05 = findViewById(R.id.videoView05);
mVideoView06 = findViewById(R.id.videoView06);

DataSource dataSource01 = new DataSource("https://mov.bn.netease.com/open-movie/nos/mp4/2016/06/22/SBP8G92E3_hd.mp4");
mVideoView01.setDataSource(dataSource01);
mVideoView01.setReceiverGroup(ReceiverGroupManager.get().getReceiverGroup(this));
mVideoView01.setEventHandler(new OnVideoViewEventHandler());
mVideoView01.start();

DataSource dataSource02 = new DataSource("https://mov.bn.netease.com/open-movie/nos/mp4/2015/08/27/SB13F5AGJ_sd.mp4");
mVideoView02.setDataSource(dataSource02);
mVideoView02.setReceiverGroup(ReceiverGroupManager.get().getReceiverGroup(this));
mVideoView02.setEventHandler(new OnVideoViewEventHandler());
mVideoView02.start();

DataSource dataSource03 = new DataSource("https://mov.bn.netease.com/open-movie/nos/mp4/2018/01/12/SD70VQJ74_sd.mp4");
mVideoView03.setDataSource(dataSource03);
mVideoView03.setReceiverGroup(ReceiverGroupManager.get().getReceiverGroup(this));
mVideoView03.setEventHandler(new OnVideoViewEventHandler());
mVideoView03.start();

DataSource dataSource04 = new DataSource("https://mov.bn.netease.com/open-movie/nos/mp4/2017/05/31/SCKR8V6E9_hd.mp4");
mVideoView04.setDataSource(dataSource04);
mVideoView04.setReceiverGroup(ReceiverGroupManager.get().getReceiverGroup(this));
mVideoView04.setEventHandler(new OnVideoViewEventHandler());
mVideoView04.start();

DataSource dataSource05 = new DataSource("https://mov.bn.netease.com/open-movie/nos/mp4/2016/01/11/SBC46Q9DV_hd.mp4");
mVideoView05.setDataSource(dataSource05);
mVideoView05.setReceiverGroup(ReceiverGroupManager.get().getReceiverGroup(this));
mVideoView05.setEventHandler(new OnVideoViewEventHandler());
mVideoView05.start();

DataSource dataSource06 = new DataSource("https://mov.bn.netease.com/open-movie/nos/mp4/2018/04/19/SDEQS1GO6_hd.mp4");
mVideoView06.setDataSource(dataSource06);
mVideoView06.setReceiverGroup(ReceiverGroupManager.get().getReceiverGroup(this));
mVideoView06.setEventHandler(new OnVideoViewEventHandler());
mVideoView06.start();
}

@Override
protected void onDestroy() {
super.onDestroy();
mVideoView01.stopPlayback();
mVideoView02.stopPlayback();
mVideoView03.stopPlayback();
mVideoView04.stopPlayback();
mVideoView05.stopPlayback();
mVideoView06.stopPlayback();
}
}
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@
android:textSize="16sp"
android:textColor="@color/buttonTextColor"/>

<Button
android:id="@+id/tv_multi_play"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:onClick="multiVideoPlay"
android:textAllCaps="false"
android:text="多实例播放"
android:textSize="16sp"
android:textColor="@color/buttonTextColor"/>

<TextView
android:id="@+id/tv_avPlayer"
android:layout_width="match_parent"
Expand Down
66 changes: 66 additions & 0 deletions app/src/main/res/layout/activity_multi_play.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="horizontal">
<com.kk.taurus.playerbase.widget.BaseVideoView
android:id="@+id/videoView01"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"/>
<com.kk.taurus.playerbase.widget.BaseVideoView
android:id="@+id/videoView02"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:background="#000000"/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<com.kk.taurus.playerbase.widget.BaseVideoView
android:id="@+id/videoView03"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"/>
<com.kk.taurus.playerbase.widget.BaseVideoView
android:id="@+id/videoView04"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:background="#000000"/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<com.kk.taurus.playerbase.widget.BaseVideoView
android:id="@+id/videoView05"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"/>
<com.kk.taurus.playerbase.widget.BaseVideoView
android:id="@+id/videoView06"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:background="#000000"/>
</LinearLayout>

</LinearLayout>

0 comments on commit d18a7c0

Please sign in to comment.