update
This commit is contained in:
parent
339d460c0f
commit
137dbc72d8
@ -10,9 +10,9 @@ ext {
|
||||
manifestPlaceholders = [
|
||||
//正式
|
||||
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
// 測試
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
//腾讯地图
|
||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||
|
@ -1 +1 @@
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'../libs/beautysdk-202202241203',ext:'aar')
implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar')
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
api project(path: ':common')
api project(path:':FaceUnity')//新娱美颜
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
}
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'../libs/beautysdk-202202241203',ext:'aar')
implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar')
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
api project(path: ':common')
api project(path:':FaceUnity')//新娱美颜
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
//ExoPlayer,腾讯的播放器不支持无缝切换
implementation 'com.google.android.exoplayer:exoplayer:2.18.2'
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar'
}
|
@ -128,7 +128,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url,int playModel) {
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
|
@ -6,15 +6,14 @@ import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL
|
||||
import android.Manifest;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
@ -23,19 +22,18 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.PlaybackException;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
import com.google.android.exoplayer2.Tracks;
|
||||
import com.google.android.exoplayer2.video.VideoSize;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzy.okserver.OkDownload;
|
||||
import com.lzy.okserver.download.DownloadTask;
|
||||
import com.tencent.live2.V2TXLiveDef;
|
||||
import com.tencent.live2.V2TXLivePlayer;
|
||||
import com.tencent.live2.V2TXLivePlayerObserver;
|
||||
import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
@ -56,7 +54,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.RCRTCRemoteUser;
|
||||
@ -89,7 +86,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private ViewGroup mLeftContainer;
|
||||
private ViewGroup mRightContainer;
|
||||
private RelativeLayout mPkContainer;
|
||||
public static TXCloudVideoView mVideoView;
|
||||
public static SurfaceView mVideoView;
|
||||
|
||||
private View mLoading, mLoading2;
|
||||
private ImageView mCover;
|
||||
@ -101,15 +98,16 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private boolean mPausedPlay;//是否被动暂停了播放
|
||||
public int landscape; //1h 2s
|
||||
public static Context contexts;
|
||||
public V2TXLivePlayer mPlayer;
|
||||
public static FrameLayout ry_view;
|
||||
|
||||
private static final int VIDEO_VERTICAL = 1;
|
||||
private static final int VIDEO_HORIZONTAL = 2;
|
||||
int videoLandscape; // 视频方向,1=竖屏,2=横屏
|
||||
int videoLandscape = -1; // 视频方向,1=竖屏,2=横屏
|
||||
|
||||
static int vHeight;//视频高
|
||||
private TextView debugView;
|
||||
private ExoPlayer mPlayer, mPlayer2;
|
||||
private boolean isPlayer = true;
|
||||
|
||||
|
||||
//0未申请1申请中2连麦中
|
||||
@ -141,7 +139,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
mLeftContainer = (ViewGroup) findViewById(R.id.left_container);
|
||||
mRightContainer = (ViewGroup) findViewById(R.id.right_container);
|
||||
mPkContainer = (RelativeLayout) findViewById(R.id.pk_container);
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
mVideoView = (SurfaceView) findViewById(R.id.video_view);
|
||||
ry_view = (FrameLayout) findViewById(R.id.ry_view);
|
||||
leave = (ImageView) findViewById(R.id.leave);
|
||||
mLoading = findViewById(R.id.loading);
|
||||
@ -154,9 +152,14 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mPkContainer.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
mPkContainer.requestLayout();
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
mPlayer.setRenderView(mVideoView);
|
||||
|
||||
mPlayer = new ExoPlayer.Builder(mContext)
|
||||
.build();
|
||||
mPlayer2 = new ExoPlayer.Builder(mContext).build();
|
||||
mPlayer.setVideoSurfaceView(mVideoView);
|
||||
mPlayer2.setVideoSurfaceView(mVideoView);
|
||||
mPlayer.addListener(new ExoPlayerListener(true));
|
||||
mPlayer2.addListener(new ExoPlayerListener(false));
|
||||
debugView = new TextView(mContext);
|
||||
debugView.setBackgroundColor(Color.WHITE);
|
||||
|
||||
@ -247,13 +250,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
*/
|
||||
@Override
|
||||
public void resumePlay() {
|
||||
if (mPlayer.isPlaying() != 1) {
|
||||
if (!mPlayer.isPlaying()) {
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(() -> {
|
||||
mPlayer.stopPlay();
|
||||
int val = mPlayer.startPlay(purl);
|
||||
mPlayer.stop();
|
||||
mPlayer.play();
|
||||
// ToastUtil.show("强制播放" + val);
|
||||
Log.i(TAG, "强制播放: " + val);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
@ -264,7 +266,14 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url, int playModel) {
|
||||
if (playModel != PLAY_MODEL_DEF) {
|
||||
if (videoLandscape == VIDEO_VERTICAL) {
|
||||
url = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
|
||||
} else if (videoLandscape == VIDEO_HORIZONTAL) {
|
||||
url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
|
||||
}
|
||||
}
|
||||
Log.e("purl121", url);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
@ -275,16 +284,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
return;
|
||||
}
|
||||
mVideoView.clearLastFrame(true);
|
||||
mPlayer.setObserver(new V2TXLivePlayerObserver() {
|
||||
String TAG = "播放流";
|
||||
|
||||
@Override
|
||||
public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||
super.onError(player, code, msg, extraInfo);
|
||||
Log.i(TAG, "onError: player = " + player + ", code = " + code + ", msg = " + msg + ", extraInfo = " + extraInfo);
|
||||
debugView.setText("播放出错code=" + code + " msg=" + msg);
|
||||
}
|
||||
/*mPlayer.setObserver(new V2TXLivePlayerObserver() {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onWarning(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||
@ -388,21 +391,55 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void onReceiveSeiMessage(V2TXLivePlayer player, int payloadType, byte[] data) {
|
||||
super.onReceiveSeiMessage(player, payloadType, data);
|
||||
}
|
||||
});
|
||||
|
||||
});*/
|
||||
MediaItem item = createMediaItem(url);
|
||||
if (mPlayer.isPlaying()) {
|
||||
ToastUtil.show("set 2");
|
||||
mPlayer2.setMediaItem(item);
|
||||
mPlayer2.setVideoSurfaceView(mVideoView);
|
||||
mPlayer2.prepare();
|
||||
mPlayer2.play();
|
||||
} else {
|
||||
ToastUtil.show("set 1");
|
||||
mPlayer.setMediaItem(item);
|
||||
mPlayer.setVideoSurfaceView(mVideoView);
|
||||
mPlayer.prepare();
|
||||
mPlayer.play();
|
||||
}
|
||||
/* if (mPlayer.isPlaying()) {
|
||||
MediaSource nextSource = new ProgressiveMediaSource.Factory(new DefaultHttpDataSource.Factory())
|
||||
.createMediaSource(createMediaItem(url));
|
||||
MediaSource oldSource = new ProgressiveMediaSource.Factory(new DefaultHttpDataSource.Factory())
|
||||
.createMediaSource(mPlayer.getCurrentMediaItem());
|
||||
ClippingMediaSource clippingMediaSource = new ClippingMediaSource(oldSource, 0, 3000, false, true, true);
|
||||
ConcatenatingMediaSource source = new ConcatenatingMediaSource(clippingMediaSource, nextSource);
|
||||
mPlayer.addMediaSource(source);
|
||||
mPlayer.prepare();
|
||||
mPlayer.setPlayWhenReady(true);
|
||||
} else {
|
||||
MediaItem item = createMediaItem(url);
|
||||
mPlayer.setMediaItem(item);
|
||||
mPlayer.prepare();
|
||||
mPlayer.play();
|
||||
}*/
|
||||
purl = url;
|
||||
int V2TXLiveCode = mPlayer.startPlay(url);
|
||||
onPrepared();
|
||||
|
||||
}
|
||||
|
||||
private MediaItem createMediaItem(String url) {
|
||||
MediaItem mediaItem = MediaItem.fromUri(url);
|
||||
return mediaItem;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mEnd = true;
|
||||
mStarted = false;
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
}
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
@ -416,7 +453,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
}
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.stop();
|
||||
}
|
||||
stopPlay2();
|
||||
}
|
||||
@ -629,7 +666,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
params.topMargin = 0;
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation270);
|
||||
// mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation270);
|
||||
mVideoView.requestLayout();
|
||||
}
|
||||
|
||||
@ -639,7 +676,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation0);
|
||||
// mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation0);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
}
|
||||
@ -703,10 +740,13 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
mPlayer.startPlay(purl);
|
||||
mPlayer.play();
|
||||
Log.e("ry", mPlayer.isPlaying() + "purl" + purl);
|
||||
if (mPlayer.isPlaying() != 1) {
|
||||
mPlayer.startPlay(purl);
|
||||
if (!mPlayer.isPlaying()) {
|
||||
MediaItem item = createMediaItem(purl);
|
||||
mPlayer.setMediaItem(item);
|
||||
mPlayer.prepare();
|
||||
mPlayer.play();
|
||||
}
|
||||
ry_view.removeAllViews();
|
||||
ry_view.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
@ -783,7 +823,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
for (RCRTCInputStream stream : data.getLiveStreams()) {
|
||||
if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
|
||||
//暂停播放
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.stop();
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
@ -1020,4 +1060,86 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void startPlay() {
|
||||
if (mPlayer.isPlaying()) {
|
||||
mPlayer.stop();
|
||||
mPlayer2.play();
|
||||
} else {
|
||||
mPlayer2.stop();
|
||||
mPlayer.play();
|
||||
}
|
||||
}
|
||||
|
||||
private class ExoPlayerListener implements Player.Listener {
|
||||
String TAG = "播放流";
|
||||
boolean isPlayer1;
|
||||
|
||||
public ExoPlayerListener(boolean isPlayer1) {
|
||||
this.isPlayer1 = isPlayer1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
if (isPlayer1) {
|
||||
mPlayer2.stop();
|
||||
Log.i(TAG, "onPlaybackStateChanged1: " + mPlayer.getCurrentMediaItem().localConfiguration.uri);
|
||||
mPlayer.setVideoSurfaceView(mVideoView);
|
||||
mPlayer.play();
|
||||
} else {
|
||||
mPlayer.stop();
|
||||
Log.i(TAG, "onPlaybackStateChanged2: " + mPlayer2.getCurrentMediaItem().localConfiguration.uri);
|
||||
mPlayer2.setVideoSurfaceView(mVideoView);
|
||||
mPlayer2.play();
|
||||
}
|
||||
|
||||
}else if (playbackState==Player.STATE_IDLE){
|
||||
if(!isPlayer1){
|
||||
mPlayer.stop();
|
||||
mPlayer2.prepare();
|
||||
}else{
|
||||
/* mPlayer2.stop();
|
||||
mPlayer.prepare();*/
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "onPlaybackStateChanged: " + playbackState + " play = " + isPlayer1 + " p1 = " + mPlayer.isPlaying() + " p2 = " + mPlayer2.isPlaying());
|
||||
isPlayer = !isPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaItemTransition(@Nullable MediaItem mediaItem, int reason) {
|
||||
Player.Listener.super.onMediaItemTransition(mediaItem, reason);
|
||||
Log.i(TAG, "onMediaItemTransition: " + reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
Player.Listener.super.onPlayerError(error);
|
||||
debugView.setText("播放出错code=" + error.errorCode + " msg=" + error.getErrorCodeName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||
if (videoSize.height > videoSize.width) {
|
||||
videoLandscape = VIDEO_VERTICAL;
|
||||
} else {
|
||||
videoLandscape = VIDEO_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimelineChanged(Timeline timeline, int reason) {
|
||||
Player.Listener.super.onTimelineChanged(timeline, reason);
|
||||
Log.i(TAG, "onTimelineChanged: " + reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTracksChanged(Tracks tracks) {
|
||||
Player.Listener.super.onTracksChanged(tracks);
|
||||
Log.i(TAG, "onTracksChanged: " + tracks.getGroups().size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url,int playModel) {
|
||||
url = "webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1";
|
||||
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
|
@ -251,7 +251,7 @@ public class LivePlayTxViewHolder_backup extends LiveRoomPlayViewHolder implemen
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url,int playModel) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return;
|
||||
}
|
||||
|
@ -13,14 +13,21 @@ import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
|
||||
public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements ILiveLinkMicViewHolder {
|
||||
protected LiveBean mLiveBean;
|
||||
public static final int PLAY_MODEL_DEF=-1;
|
||||
public static final int PLAY_MODEL_480=0;
|
||||
public static final int PLAY_MODEL_720=1;
|
||||
public static final int PLAY_MODEL_1080=2;
|
||||
|
||||
public static final String[] videoRatioHorizontal = new String[]{"_640_480", "_960_720", "_1920_1080","_180_180"};
|
||||
public static final String[] videoRatioVertical = new String[]{"_480_640", "_720_960", "_1080_1920","_180_180"};
|
||||
public static final String[] videoFps = new String[]{"_24", "_30"};
|
||||
OnMicCallback onMicCallback;//连麦回调
|
||||
|
||||
public LiveRoomPlayViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
}
|
||||
|
||||
public abstract void play(String url);
|
||||
public abstract void play(String url,int playModel);
|
||||
|
||||
public abstract void stopPlay();
|
||||
|
||||
|
@ -837,7 +837,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mLiveUserAdapter.setOnItemClickListener(new OnItemClickListener<UserBean>() {
|
||||
@Override
|
||||
public void onItemClick(UserBean bean, int position) {
|
||||
showUserDialog(bean.getId());
|
||||
if (position < 4) {
|
||||
ToastUtil.show("切换:" + LiveRoomPlayViewHolder.videoRatioVertical[position]);
|
||||
PortraitLiveManager.portraitLiveManager.test(position);
|
||||
} else {
|
||||
showUserDialog(bean.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
mUserRecyclerView.setAdapter(mLiveUserAdapter);
|
||||
|
@ -186,6 +186,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
private int landscape;
|
||||
private String leaveStream = "", leaveGroupId = "";
|
||||
public static PortraitLiveManager portraitLiveManager;
|
||||
|
||||
|
||||
public PortraitLiveManager setQuitF(boolean quitF) {
|
||||
isQuitF = quitF;
|
||||
@ -196,6 +198,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
this.mContext = context;
|
||||
this.mIntent = intent;
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
portraitLiveManager=this;
|
||||
ininView();
|
||||
}
|
||||
|
||||
@ -296,7 +299,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mask.setVisibility(View.VISIBLE);
|
||||
mLivePlayViewHolder.setLiveBean(mLiveBean);
|
||||
mLivePlayViewHolder.setCover(mLiveBean.getAvatar());
|
||||
mLivePlayViewHolder.play(mLiveBean.getPull());
|
||||
mLivePlayViewHolder.play(mLiveBean.getPull(), LiveRoomPlayViewHolder.PLAY_MODEL_DEF);
|
||||
mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() {
|
||||
@Override
|
||||
public void onMikUpdate() {
|
||||
@ -326,7 +329,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void test(int model) {
|
||||
mLivePlayViewHolder.play(mLiveBean.getPull(), model);
|
||||
}
|
||||
private Runnable sendFIm = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -7,7 +7,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<SurfaceView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
Loading…
Reference in New Issue
Block a user