还原成腾讯播放器
This commit is contained in:
parent
7e169e882d
commit
b5ebc085b4
@ -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"
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.1'
implementation 'com.google.android.exoplayer:exoplayer-rtsp:2.17.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.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"
}
|
@ -18,10 +18,6 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.ui.StyledPlayerView;
|
||||
import com.lzy.okserver.OkDownload;
|
||||
import com.lzy.okserver.download.DownloadTask;
|
||||
import com.tencent.live2.V2TXLiveDef;
|
||||
@ -82,7 +78,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private ViewGroup mLeftContainer;
|
||||
private ViewGroup mRightContainer;
|
||||
private RelativeLayout mPkContainer;
|
||||
public static StyledPlayerView mVideoView;
|
||||
public static TXCloudVideoView mVideoView;
|
||||
|
||||
private View mLoading;
|
||||
private ImageView mCover;
|
||||
@ -94,7 +90,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private boolean mPausedPlay;//是否被动暂停了播放
|
||||
public static int landscape; //1h 2s
|
||||
public static Context contexts;
|
||||
public ExoPlayer mPlayer;
|
||||
public V2TXLivePlayer mPlayer;
|
||||
public static FrameLayout ry_view;
|
||||
|
||||
|
||||
@ -138,7 +134,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 = (StyledPlayerView) findViewById(R.id.video_view);
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
ry_view = (FrameLayout) findViewById(R.id.ry_view);
|
||||
leave = (ImageView) findViewById(R.id.leave);
|
||||
mLoading = findViewById(R.id.loading);
|
||||
@ -150,11 +146,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mPkContainer.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
mPkContainer.requestLayout();
|
||||
|
||||
mPlayer = new ExoPlayer.Builder(mContext)
|
||||
.build();
|
||||
mVideoView.setPlayer(mPlayer);
|
||||
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
mPlayer.setRenderView(mVideoView);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -205,14 +198,103 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
return;
|
||||
}
|
||||
//mPlayer.setCacheParams(1.0f, 5.0f);
|
||||
if(mPlayer.isPlaying()){
|
||||
mPlayer.stop();
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarning(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||
super.onWarning(player, code, msg, extraInfo);
|
||||
Log.i(TAG, "onWarning: " + "player = " + player + ", code = " + code + ", msg = " + msg + ", extraInfo = " + extraInfo);
|
||||
if (code == 2105) {
|
||||
// mPlayer.resumeVideo();
|
||||
// mPlayer.resumeAudio();
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.startPlay(purl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoPlayStatusUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayStatus status, V2TXLiveDef.V2TXLiveStatusChangeReason reason, Bundle extraInfo) {
|
||||
super.onVideoPlayStatusUpdate(player, status, reason, extraInfo);
|
||||
//Log.i(TAG, "onVideoPlayStatusUpdate: " + "player = " + player + ", status = " + status + ", reason = " + reason + ", extraInfo = " + extraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioPlayStatusUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayStatus status, V2TXLiveDef.V2TXLiveStatusChangeReason reason, Bundle extraInfo) {
|
||||
super.onAudioPlayStatusUpdate(player, status, reason, extraInfo);
|
||||
//Log.i(TAG, "onAudioPlayStatusUpdate: " + "player = " + player + ", status = " + status + ", reason = " + reason + ", extraInfo = " + extraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayoutVolumeUpdate(V2TXLivePlayer player, int volume) {
|
||||
super.onPlayoutVolumeUpdate(player, volume);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatisticsUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayerStatistics statistics) {
|
||||
super.onStatisticsUpdate(player, statistics);
|
||||
Map<String, DownloadTask> taskMap = OkDownload.getInstance().getTaskMap();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("|");
|
||||
for (String key : taskMap.keySet()) {
|
||||
DownloadTask task = taskMap.get(key);
|
||||
buffer.append(task.progress.fileName).append(":");
|
||||
int status = task.progress.status;
|
||||
switch (status) {
|
||||
case 0:
|
||||
buffer.append("无状态");
|
||||
break;
|
||||
case 1:
|
||||
buffer.append("等待");
|
||||
break;
|
||||
case 2:
|
||||
buffer.append("下载中:").append(task.progress.fraction);
|
||||
break;
|
||||
case 3:
|
||||
buffer.append("暂停");
|
||||
break;
|
||||
case 4:
|
||||
buffer.append("错误");
|
||||
break;
|
||||
case 5:
|
||||
buffer.append("完成");
|
||||
break;
|
||||
}
|
||||
buffer.append("|");
|
||||
}
|
||||
//Log.i(TAG, "onStatisticsUpdate: " + JSON.toJSONString(statistics) + " |当前下载数 : " + OkDownload.getInstance().getTaskMap().size() + buffer);
|
||||
if (statistics.fps == 0) {
|
||||
OkDownload.getInstance().pauseAll();
|
||||
} else {
|
||||
OkDownload.getInstance().startAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSnapshotComplete(V2TXLivePlayer player, Bitmap image) {
|
||||
super.onSnapshotComplete(player, image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderVideoFrame(V2TXLivePlayer player, V2TXLiveDef.V2TXLiveVideoFrame videoFrame) {
|
||||
super.onRenderVideoFrame(player, videoFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveSeiMessage(V2TXLivePlayer player, int payloadType, byte[] data) {
|
||||
super.onReceiveSeiMessage(player, payloadType, data);
|
||||
}
|
||||
});
|
||||
|
||||
purl = url;
|
||||
MediaItem item = MediaItem.fromUri(url);
|
||||
mPlayer.setMediaItem(item);
|
||||
mPlayer.prepare();
|
||||
mPlayer.play();
|
||||
mPlayer.startPlay(url);
|
||||
onPrepared();
|
||||
|
||||
}
|
||||
@ -223,8 +305,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
mEnd = true;
|
||||
mStarted = false;
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
mPlayer.stopPlay();
|
||||
}
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
@ -238,7 +319,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
}
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stop();
|
||||
mPlayer.stopPlay();
|
||||
}
|
||||
stopPlay2();
|
||||
}
|
||||
@ -427,7 +508,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();
|
||||
}
|
||||
|
||||
@ -437,7 +518,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();
|
||||
}
|
||||
@ -484,11 +565,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
mPlayer.setMediaItem(MediaItem.fromUri(purl));
|
||||
mPlayer.startPlay(purl);
|
||||
Log.e("ry", mPlayer.isPlaying() + "purl" + purl);
|
||||
if (!mPlayer.isPlaying()) {
|
||||
mPlayer.prepare();
|
||||
mPlayer.play();
|
||||
if (mPlayer.isPlaying() != 1) {
|
||||
mPlayer.startPlay(purl);
|
||||
}
|
||||
ry_view.removeAllViews();
|
||||
onPrepared();
|
||||
@ -550,7 +630,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
for (RCRTCInputStream stream : data.getLiveStreams()) {
|
||||
if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
|
||||
//暂停播放
|
||||
mPlayer.stop();
|
||||
mPlayer.stopPlay();
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
|
@ -1056,6 +1056,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mLiveChatAdapter.clear();
|
||||
}
|
||||
}
|
||||
public void clearGuardIcon(){
|
||||
if(userGuard!=null){
|
||||
userGuard.setImageResource(R.mipmap.img_guardian_empty);
|
||||
}
|
||||
}
|
||||
public synchronized void showStart(StarChallengeStatusModel data) {
|
||||
boolean upData = false;
|
||||
if (mBannerList2 != null && mBannerList2.size() == 0) {
|
||||
|
@ -221,7 +221,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
liveBack = mRootContainer.findViewById(R.id.live_back);
|
||||
mask = mRootContainer.findViewById(R.id.mask);
|
||||
}
|
||||
private static boolean test=true;
|
||||
@Override
|
||||
public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
|
||||
openParametersModel = new OpenParametersModel();
|
||||
@ -239,8 +238,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
.setParametersModel(openParametersModel
|
||||
.setmLiveType(mLiveType)
|
||||
.setmLiveTypeVal(mLiveTypeVal)));
|
||||
if (mLivePlayViewHolder == null && test) {
|
||||
test=false;
|
||||
if (mLivePlayViewHolder == null) {
|
||||
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
|
||||
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
|
||||
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
|
||||
@ -253,9 +251,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveAudienceViewHolder.addToParent();
|
||||
mLiveRoomViewHolder.addToParent();
|
||||
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
|
||||
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this);
|
||||
}
|
||||
if(true) {
|
||||
//直播间背景
|
||||
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
|
||||
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
|
||||
@ -268,6 +264,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.setName(data.getUserNiceName());
|
||||
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
|
||||
mLiveRoomViewHolder.setTitle(data.getTitle());
|
||||
mLiveRoomViewHolder.clearGuardIcon();
|
||||
|
||||
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
||||
|
||||
@ -277,7 +274,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||
}
|
||||
}
|
||||
//心愿单
|
||||
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
|
||||
@Override
|
||||
@ -304,11 +300,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
});
|
||||
enterRoom();
|
||||
if(true) {
|
||||
mLiveRoomViewHolder.initHourRankList();
|
||||
mLiveRoomViewHolder.showLiveRoomActivityBanner();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -8,10 +8,9 @@
|
||||
>
|
||||
|
||||
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
app:use_controller="false"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
|
Loading…
Reference in New Issue
Block a user