优化:替换社区视频播放器
优化:适配Android14图片权限
This commit is contained in:
parent
61b1101c3f
commit
238dfcc2d3
@ -54,6 +54,7 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.NETWORK_PROVIDER" />
|
<uses-permission android:name="android.permission.NETWORK_PROVIDER" />
|
||||||
|
@ -86,6 +86,7 @@ dependencies {
|
|||||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||||
api files('libs/jcc-bate-0.7.3.jar')
|
api files('libs/jcc-bate-0.7.3.jar')
|
||||||
compileOnly fileTree(dir: '../libs', include: ['*.aar'])
|
compileOnly fileTree(dir: '../libs', include: ['*.aar'])
|
||||||
|
api 'androidx.activity:activity:1.9.1'
|
||||||
api rootProject.ext.dependencies["appcompat-androidx"]
|
api rootProject.ext.dependencies["appcompat-androidx"]
|
||||||
api rootProject.ext.dependencies["recyclerview-androidx"]
|
api rootProject.ext.dependencies["recyclerview-androidx"]
|
||||||
api rootProject.ext.dependencies["cardview-androidx"]
|
api rootProject.ext.dependencies["cardview-androidx"]
|
||||||
|
@ -145,6 +145,9 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
|||||||
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_GAME_LOAD_OVER)) {
|
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_GAME_LOAD_OVER)) {
|
||||||
joinAiRobot();
|
joinAiRobot();
|
||||||
}
|
}
|
||||||
|
if(SudMGPMGState.MG_COMMON_GAME_STATE.equals(event.getSudMGPMGState())){
|
||||||
|
reset();
|
||||||
|
}
|
||||||
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_COMMON_PLAYER_IN)) {
|
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_COMMON_PLAYER_IN)) {
|
||||||
LogUtils.e("收到的回调: AI uid = " + getAiUid() + "| kickUid = " + event.getPlayerIn().kickUID + "|" + getPlayerSize());
|
LogUtils.e("收到的回调: AI uid = " + getAiUid() + "| kickUid = " + event.getPlayerIn().kickUID + "|" + getPlayerSize());
|
||||||
if (event.getPlayerIn().reason == 1 && aiInfo != null) {
|
if (event.getPlayerIn().reason == 1 && aiInfo != null) {
|
||||||
@ -185,7 +188,7 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGameMGCommonGameBilliardsHitState(SudMGPMGState.MGCommonGameBilliardsHitState model) {
|
public void onGameMGCommonGameBilliardsHitState(SudMGPMGState.MGCommonGameBilliardsHitState model) {
|
||||||
LogUtils.e("uid:"+model.uid,"state:"+model.state);
|
LogUtils.e("uid:"+model.uid,"state:"+model.state,"isOneOverForMy:"+isOneOverForMy,"isOneOverForOther:"+isOneOverForOther);
|
||||||
if (Integer.parseInt(model.uid) == IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId()) {
|
if (Integer.parseInt(model.uid) == IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId()) {
|
||||||
if (isOneOverForMy == -1) {
|
if (isOneOverForMy == -1) {
|
||||||
isOneOverForMy = 1;
|
isOneOverForMy = 1;
|
||||||
@ -282,6 +285,7 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onSendNotOneOver() {
|
private void onSendNotOneOver() {
|
||||||
|
ToastUtil.showDebug("标记丢失一杆清台");
|
||||||
LiveNetManager.get(AppManager.getInstance().getMainActivity())
|
LiveNetManager.get(AppManager.getInstance().getMainActivity())
|
||||||
.ballClearanceTableStatus(data.getSudGameRoomId(), new HttpCallback<BaseModel>() {
|
.ballClearanceTableStatus(data.getSudGameRoomId(), new HttpCallback<BaseModel>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,13 +3,20 @@ package com.yunbao.common.utils;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.ImageDecoder;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.PickVisualMediaRequest;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.yalantis.ucrop.UCrop;
|
import com.yalantis.ucrop.UCrop;
|
||||||
import com.yalantis.ucrop.util.FileUtils;
|
import com.yalantis.ucrop.util.FileUtils;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
@ -39,6 +46,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
private ImageResultCallback mResultCallback;
|
private ImageResultCallback mResultCallback;
|
||||||
private boolean mNeedCrop;//是否需要裁剪
|
private boolean mNeedCrop;//是否需要裁剪
|
||||||
private boolean mNeedGif;//允许gif图
|
private boolean mNeedGif;//允许gif图
|
||||||
|
ActivityResultLauncher<PickVisualMediaRequest> launcher;
|
||||||
|
|
||||||
public void setNeedGif(boolean mNeedGif) {
|
public void setNeedGif(boolean mNeedGif) {
|
||||||
this.mNeedGif = mNeedGif;
|
this.mNeedGif = mNeedGif;
|
||||||
@ -83,7 +91,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
if (mNeedCrop) {
|
if (mNeedCrop) {
|
||||||
Uri uri = null;
|
Uri uri = null;
|
||||||
if (Build.VERSION.SDK_INT >= 24) {
|
if (Build.VERSION.SDK_INT >= 24) {
|
||||||
uri = FileProvider.getUriForFile(mContext, mContext.getPackageName()+".fileprovider", mCameraResult);
|
uri = FileProvider.getUriForFile(mContext, mContext.getPackageName() + ".fileprovider", mCameraResult);
|
||||||
} else {
|
} else {
|
||||||
uri = Uri.fromFile(mCameraResult);
|
uri = Uri.fromFile(mCameraResult);
|
||||||
}
|
}
|
||||||
@ -117,6 +125,19 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String path = FileUtils.getPath(mContext, intent.getData());
|
String path = FileUtils.getPath(mContext, intent.getData());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
ImageDecoder.Source source = ImageDecoder.createSource(mContext.getContentResolver(), intent.getData());
|
||||||
|
try {
|
||||||
|
Bitmap bitmap = ImageDecoder.decodeBitmap(source);
|
||||||
|
path=BitmapUtil.getInstance().saveBitmap(bitmap);
|
||||||
|
bitmap.recycle();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
mResultCallback.onFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
mResultCallback.onSuccess(file);
|
mResultCallback.onSuccess(file);
|
||||||
@ -153,6 +174,19 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
launcher = ((AppCompatActivity) mContext).registerForActivityResult(new ActivityResultContracts.PickVisualMedia(), new androidx.activity.result.ActivityResultCallback<Uri>() {
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(Uri result) {
|
||||||
|
LogUtils.e("result:" + result);
|
||||||
|
if (result == null) {
|
||||||
|
mAlumbResultCallback.onFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setData(result);
|
||||||
|
mAlumbResultCallback.onSuccess(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,15 +207,28 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
/**
|
/**
|
||||||
* 相册获取图片
|
* 相册获取图片
|
||||||
*/
|
*/
|
||||||
public void getImageByAlumb() {
|
public void getImageByAlbum() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
showSystemPick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getImageByAlumb(boolean needCrop) {
|
public void getImageByAlbum(boolean needCrop) {
|
||||||
this.mNeedCrop = needCrop;
|
this.mNeedCrop = needCrop;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
showSystemPick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showSystemPick() {
|
||||||
|
PickVisualMediaRequest.Builder builder = new PickVisualMediaRequest.Builder()
|
||||||
|
.setMediaType(ActivityResultContracts.PickVisualMedia.ImageOnly.INSTANCE);
|
||||||
|
launcher.launch(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启摄像头,执行照相
|
* 开启摄像头,执行照相
|
||||||
@ -195,7 +242,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
mCameraResult = getNewFile();
|
mCameraResult = getNewFile();
|
||||||
Uri uri = null;
|
Uri uri = null;
|
||||||
if (Build.VERSION.SDK_INT >= 24) {
|
if (Build.VERSION.SDK_INT >= 24) {
|
||||||
uri = FileProvider.getUriForFile(mContext, mContext.getPackageName()+".fileprovider", mCameraResult);
|
uri = FileProvider.getUriForFile(mContext, mContext.getPackageName() + ".fileprovider", mCameraResult);
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
} else {
|
} else {
|
||||||
uri = Uri.fromFile(mCameraResult);
|
uri = Uri.fromFile(mCameraResult);
|
||||||
@ -255,7 +302,7 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
|||||||
startActivityForResult(intent, mCropResultCallback);
|
startActivityForResult(intent, mCropResultCallback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
Uri resultUri = FileProvider.getUriForFile(mContext, mContext.getPackageName()+".fileprovider", mCorpResult);
|
Uri resultUri = FileProvider.getUriForFile(mContext, mContext.getPackageName() + ".fileprovider", mCorpResult);
|
||||||
if (resultUri == null || mFragment == null || mContext == null) {
|
if (resultUri == null || mFragment == null || mContext == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,9 @@ public class WordUtil {
|
|||||||
|
|
||||||
public static boolean isNewZh() {
|
public static boolean isNewZh() {
|
||||||
return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE
|
return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE
|
||||||
|| IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.TRADITIONAL_CHINESE ;
|
|| IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.TRADITIONAL_CHINESE
|
||||||
|
|| IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.CHINESE
|
||||||
|
|| IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.CHINA;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNewString(int res) {
|
public static String getNewString(int res) {
|
||||||
|
@ -22,7 +22,7 @@ ext {
|
|||||||
// "tencent-bugly" : 'com.tencent.bugly:crashreport:2.6.6',//腾讯bugly
|
// "tencent-bugly" : 'com.tencent.bugly:crashreport:2.6.6',//腾讯bugly
|
||||||
// "umeng-common" : 'com.umeng.sdk:common:1.5.3',//友盟统计
|
// "umeng-common" : 'com.umeng.sdk:common:1.5.3',//友盟统计
|
||||||
// "umeng-analytics" : 'com.umeng.sdk:analytics:7.5.3',//友盟统计
|
// "umeng-analytics" : 'com.umeng.sdk:analytics:7.5.3',//友盟统计
|
||||||
"ucrop" : 'com.github.yalantis:ucrop:2.2.3',//图片裁剪
|
"ucrop" : 'com.github.yalantis:ucrop:2.2.9',//图片裁剪
|
||||||
"smartRefreshLayout" : 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-20',//下拉刷新上拉加载
|
"smartRefreshLayout" : 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-20',//下拉刷新上拉加载
|
||||||
"magicIndicator" : 'com.github.hackware1993:MagicIndicator:1.6.0',//ViewPager指示器
|
"magicIndicator" : 'com.github.hackware1993:MagicIndicator:1.6.0',//ViewPager指示器
|
||||||
"banner" : 'com.ms:banner:1.0.0',//轮播图
|
"banner" : 'com.ms:banner:1.0.0',//轮播图
|
||||||
|
@ -237,7 +237,7 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -691,7 +691,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
*/
|
*/
|
||||||
private void setAvatar() {
|
private void setAvatar() {
|
||||||
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
} else {
|
} else {
|
||||||
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
||||||
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
||||||
@ -700,7 +700,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -673,7 +673,7 @@ public class LiveNewReadySwViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
*/
|
*/
|
||||||
private void setAvatar() {
|
private void setAvatar() {
|
||||||
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum(true);
|
||||||
} else {
|
} else {
|
||||||
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
||||||
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
||||||
@ -682,7 +682,7 @@ public class LiveNewReadySwViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,6 @@ import com.yunbao.live.R;
|
|||||||
import com.yunbao.live.activity.LiveActivity;
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
import com.yunbao.live.activity.LiveChooseClassActivity;
|
import com.yunbao.live.activity.LiveChooseClassActivity;
|
||||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
|
||||||
import com.yunbao.live.adapter.LiveReadyShareAdapter;
|
import com.yunbao.live.adapter.LiveReadyShareAdapter;
|
||||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||||
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
|
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
|
||||||
@ -262,7 +261,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
|
|||||||
*/
|
*/
|
||||||
private void setAvatar() {
|
private void setAvatar() {
|
||||||
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
} else {
|
} else {
|
||||||
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
||||||
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
||||||
@ -271,7 +270,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -285,7 +285,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
|||||||
*/
|
*/
|
||||||
private void setAvatar() {
|
private void setAvatar() {
|
||||||
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
} else {
|
} else {
|
||||||
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
||||||
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
||||||
@ -294,7 +294,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2208,11 +2208,6 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<com.opensource.svgaplayer.SVGAImageView
|
|
||||||
android:id="@+id/enter_room_svg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:scaleType="fitCenter" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/inner_container"
|
android:id="@+id/inner_container"
|
||||||
@ -2832,4 +2827,9 @@
|
|||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
|
android:id="@+id/enter_room_svg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -439,7 +439,7 @@ public class EditProfileActivity extends AbsActivity {
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else if (tag == R.string.alumb) {
|
} else if (tag == R.string.alumb) {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum(true);
|
||||||
} else {
|
} else {
|
||||||
RouteUtil.forwardUserAvatarSelect();
|
RouteUtil.forwardUserAvatarSelect();
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,6 @@ import com.yunbao.main.R;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
@Route(path = RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY)
|
@Route(path = RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY)
|
||||||
public class FeedbackEditActivity extends AbsActivity {
|
public class FeedbackEditActivity extends AbsActivity {
|
||||||
@ -299,7 +297,7 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
loadingDialog = DialogUitl.loadingDialog(mContext);
|
loadingDialog = DialogUitl.loadingDialog(mContext);
|
||||||
loadingDialog.show();
|
loadingDialog.show();
|
||||||
if (tag == 1) {
|
if (tag == 1) {
|
||||||
imageUtil.getImageByAlumb(false);
|
imageUtil.getImageByAlbum(false);
|
||||||
} else {
|
} else {
|
||||||
imageUtil.getImageByCamera(false);
|
imageUtil.getImageByCamera(false);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.jakewharton.rxbinding3.view.RxView;
|
import com.jakewharton.rxbinding3.view.RxView;
|
||||||
@ -55,6 +56,7 @@ import com.tencent.imsdk.v2.V2TIMManager;
|
|||||||
import com.tencent.imsdk.v2.V2TIMSDKConfig;
|
import com.tencent.imsdk.v2.V2TIMSDKConfig;
|
||||||
import com.tencent.imsdk.v2.V2TIMSDKListener;
|
import com.tencent.imsdk.v2.V2TIMSDKListener;
|
||||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||||
|
import com.yunbao.common.CommonAppContext;
|
||||||
import com.yunbao.common.bean.QiniuLog;
|
import com.yunbao.common.bean.QiniuLog;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.server.DownloadService;
|
import com.yunbao.common.server.DownloadService;
|
||||||
@ -232,6 +234,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
|
LogUtils.e("MainActivity",
|
||||||
|
"语言:"+IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage(),
|
||||||
|
"测试文本:"+getString(R.string.hot)
|
||||||
|
);
|
||||||
|
ToastUtil.showDebug("打包时间:"+CommonAppConfig.BUILD_TIME+"\n系统语言:"+IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage());
|
||||||
//初始化声网
|
//初始化声网
|
||||||
SWAuManager.get().initRtcEngine(this);
|
SWAuManager.get().initRtcEngine(this);
|
||||||
ActivityCompat.postponeEnterTransition(this);
|
ActivityCompat.postponeEnterTransition(this);
|
||||||
|
@ -585,7 +585,7 @@ public class MyWebViewActivity extends AbsActivity {
|
|||||||
if (tag == com.yunbao.main.R.string.camera) {
|
if (tag == com.yunbao.main.R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -49,7 +49,7 @@ public class OneLoginActivity extends AbsActivity {
|
|||||||
if (tag == R.string.camera) {
|
if (tag == R.string.camera) {
|
||||||
mImageUtil.getImageByCamera();
|
mImageUtil.getImageByCamera();
|
||||||
} else {
|
} else {
|
||||||
mImageUtil.getImageByAlumb();
|
mImageUtil.getImageByAlbum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -169,7 +169,12 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType();
|
boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType();
|
||||||
if (isAnchor) {
|
if (isAnchor) {
|
||||||
String[] permissions;
|
String[] permissions;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
permissions = new String[]{
|
||||||
|
Manifest.permission.CAMERA,
|
||||||
|
Manifest.permission.RECORD_AUDIO
|
||||||
|
};
|
||||||
|
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU) {
|
||||||
permissions = new String[]{
|
permissions = new String[]{
|
||||||
Manifest.permission.READ_MEDIA_IMAGES,
|
Manifest.permission.READ_MEDIA_IMAGES,
|
||||||
Manifest.permission.CAMERA,
|
Manifest.permission.CAMERA,
|
||||||
@ -195,7 +200,12 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType();
|
boolean isAnchor = IMLoginManager.get(mContext).getUserInfo().anchorUserType();
|
||||||
if (isAnchor) {
|
if (isAnchor) {
|
||||||
String[] permissions;
|
String[] permissions;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
permissions = new String[]{
|
||||||
|
Manifest.permission.CAMERA,
|
||||||
|
Manifest.permission.RECORD_AUDIO
|
||||||
|
};
|
||||||
|
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU) {
|
||||||
permissions = new String[]{
|
permissions = new String[]{
|
||||||
Manifest.permission.READ_MEDIA_IMAGES,
|
Manifest.permission.READ_MEDIA_IMAGES,
|
||||||
Manifest.permission.CAMERA,
|
Manifest.permission.CAMERA,
|
||||||
@ -234,9 +244,9 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
JSONObject obj1 = JSON.parseObject(info1[0]);
|
JSONObject obj1 = JSON.parseObject(info1[0]);
|
||||||
try {
|
try {
|
||||||
if(code==201){ //声网
|
if (code == 201) { //声网
|
||||||
LiveSwAnchorActivity.forward(mContext, Constants.LIVE_SDK_SW, JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
|
LiveSwAnchorActivity.forward(mContext, Constants.LIVE_SDK_SW, JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
|
||||||
}else if(code==200){//融云
|
} else if (code == 200) {//融云
|
||||||
LiveRyAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
|
LiveRyAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -309,7 +319,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
if (i == R.id.btn_close) {
|
if (i == R.id.btn_close) {
|
||||||
} else if (i == R.id.btn_live) {
|
} else if (i == R.id.btn_live) {
|
||||||
if (isWifiProxy(mContext) || checkVPN((ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE))) {
|
if (isWifiProxy(mContext) || checkVPN((ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE))) {
|
||||||
ToastUtil.show(WordUtil.isNewZh()?"檢測開啓了VPN或者代理,請先關閉VPN或者代理再開播。":
|
ToastUtil.show(WordUtil.isNewZh() ? "檢測開啓了VPN或者代理,請先關閉VPN或者代理再開播。" :
|
||||||
"It is detected that VPN or proxy is turned on. Please turn off VPN or proxy before starting the broadcast.");
|
"It is detected that VPN or proxy is turned on. Please turn off VPN or proxy before starting the broadcast.");
|
||||||
} else {
|
} else {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
@ -324,6 +334,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWifiProxy(Context context) {
|
private boolean isWifiProxy(Context context) {
|
||||||
final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||||
String proxyAddress;
|
String proxyAddress;
|
||||||
@ -345,6 +356,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
|||||||
boolean isVpnConn = networkInfo == null ? false : networkInfo.isConnected();
|
boolean isVpnConn = networkInfo == null ? false : networkInfo.isConnected();
|
||||||
return isVpnConn;
|
return isVpnConn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
@ -10,11 +10,19 @@ import android.view.ViewGroup;
|
|||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import com.tencent.rtmp.ITXVodPlayListener;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
|
import com.google.android.exoplayer2.C;
|
||||||
|
import com.google.android.exoplayer2.DefaultLoadControl;
|
||||||
|
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.ui.AspectRatioFrameLayout;
|
||||||
|
import com.google.android.exoplayer2.ui.StyledPlayerView;
|
||||||
|
import com.google.android.exoplayer2.video.VideoSize;
|
||||||
import com.tencent.rtmp.TXLiveConstants;
|
import com.tencent.rtmp.TXLiveConstants;
|
||||||
import com.tencent.rtmp.TXVodPlayConfig;
|
|
||||||
import com.tencent.rtmp.TXVodPlayer;
|
|
||||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.views.AbsViewHolder;
|
import com.yunbao.common.views.AbsViewHolder;
|
||||||
import com.yunbao.video.R;
|
import com.yunbao.video.R;
|
||||||
@ -27,11 +35,11 @@ import com.yunbao.video.http.VideoHttpUtil;
|
|||||||
* 视频播放器
|
* 视频播放器
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayListener, View.OnClickListener {
|
public class VideoPlayViewHolder extends AbsViewHolder implements View.OnClickListener {
|
||||||
|
|
||||||
private TXCloudVideoView mTXCloudVideoView;
|
private StyledPlayerView mTXCloudVideoView;
|
||||||
private View mVideoCover;
|
private View mVideoCover;
|
||||||
private TXVodPlayer mPlayer;
|
private ExoPlayer mPlayer;
|
||||||
private boolean mPaused;//生命周期暂停
|
private boolean mPaused;//生命周期暂停
|
||||||
private boolean mClickPaused;//点击暂停
|
private boolean mClickPaused;//点击暂停
|
||||||
private ActionListener mActionListener;
|
private ActionListener mActionListener;
|
||||||
@ -41,7 +49,6 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
private boolean mEndPlay;
|
private boolean mEndPlay;
|
||||||
private VideoBean mVideoBean;
|
private VideoBean mVideoBean;
|
||||||
private String mCachePath;
|
private String mCachePath;
|
||||||
private TXVodPlayConfig mTXVodPlayConfig;
|
|
||||||
|
|
||||||
public VideoPlayViewHolder(Context context, ViewGroup parentView) {
|
public VideoPlayViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -55,17 +62,21 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
|
DefaultLoadControl control = new DefaultLoadControl.Builder()
|
||||||
|
.setPrioritizeTimeOverSizeThresholds(false)
|
||||||
|
.setBackBuffer(10_000, true)
|
||||||
|
.setBufferDurationsMs(500,
|
||||||
|
5_000,
|
||||||
|
150,
|
||||||
|
200)
|
||||||
|
.build();
|
||||||
|
|
||||||
mCachePath = mContext.getCacheDir().getAbsolutePath();
|
mCachePath = mContext.getCacheDir().getAbsolutePath();
|
||||||
mTXCloudVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
mTXCloudVideoView = (StyledPlayerView) findViewById(R.id.placeholderView);
|
||||||
mTXCloudVideoView.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
|
mTXCloudVideoView.setKeepContentOnPlayerReset(true);
|
||||||
mPlayer = new TXVodPlayer(mContext);
|
mTXCloudVideoView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH);
|
||||||
mTXVodPlayConfig = new TXVodPlayConfig();
|
mPlayer = new ExoPlayer.Builder(mContext).setLoadControl(control).build();
|
||||||
mTXVodPlayConfig.setMaxCacheItems(15);
|
mPlayer.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
|
||||||
mTXVodPlayConfig.setProgressInterval(200);
|
|
||||||
mPlayer.setConfig(mTXVodPlayConfig);
|
|
||||||
mPlayer.setAutoPlay(true);
|
|
||||||
mPlayer.setVodListener(this);
|
|
||||||
mPlayer.setPlayerView(mTXCloudVideoView);
|
|
||||||
findViewById(R.id.root).setOnClickListener(this);
|
findViewById(R.id.root).setOnClickListener(this);
|
||||||
mVideoCover = findViewById(R.id.video_cover);
|
mVideoCover = findViewById(R.id.video_cover);
|
||||||
mPlayBtn = findViewById(R.id.btn_play);
|
mPlayBtn = findViewById(R.id.btn_play);
|
||||||
@ -76,13 +87,59 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
PropertyValuesHolder.ofFloat("alpha", 0f, 1f));
|
PropertyValuesHolder.ofFloat("alpha", 0f, 1f));
|
||||||
mPlayBtnAnimator.setDuration(150);
|
mPlayBtnAnimator.setDuration(150);
|
||||||
mPlayBtnAnimator.setInterpolator(new AccelerateInterpolator());
|
mPlayBtnAnimator.setInterpolator(new AccelerateInterpolator());
|
||||||
|
mPlayer.addListener(new Player.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onIsPlayingChanged(boolean isPlaying) {
|
||||||
|
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaybackStateChanged(int playbackState) {
|
||||||
|
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
||||||
|
if (playbackState == Player.STATE_READY) {
|
||||||
|
mPlayer.play();
|
||||||
|
onPlayEvent(TXLiveConstants.PLAY_EVT_PLAY_BEGIN, null);
|
||||||
|
} else if (playbackState == Player.STATE_BUFFERING) {
|
||||||
|
onPlayEvent(TXLiveConstants.PLAY_EVT_PLAY_LOADING, null);
|
||||||
|
} else if (playbackState == Player.STATE_ENDED) {
|
||||||
|
onPlayEvent(TXLiveConstants.PLAY_EVT_PLAY_END, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||||
|
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt("EVT_PARAM1", videoSize.width);
|
||||||
|
bundle.putInt("EVT_PARAM2", videoSize.height);
|
||||||
|
onPlayEvent(TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION, bundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRenderedFirstFrame() {
|
||||||
|
Player.Listener.super.onRenderedFirstFrame();
|
||||||
|
onPlayEvent(TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerError(PlaybackException error) {
|
||||||
|
Player.Listener.super.onPlayerError(error);
|
||||||
|
LogUtils.e(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerErrorChanged(@Nullable PlaybackException error) {
|
||||||
|
Player.Listener.super.onPlayerErrorChanged(error);
|
||||||
|
LogUtils.e(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mTXCloudVideoView.setPlayer(mPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 播放器事件回调
|
* 播放器事件回调
|
||||||
*/
|
*/
|
||||||
@Override
|
public void onPlayEvent(int e, Bundle bundle) {
|
||||||
public void onPlayEvent(TXVodPlayer txVodPlayer, int e, Bundle bundle) {
|
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case TXLiveConstants.PLAY_EVT_PLAY_BEGIN://加载完成,开始播放的回调
|
case TXLiveConstants.PLAY_EVT_PLAY_BEGIN://加载完成,开始播放的回调
|
||||||
mStartPlay = true;
|
mStartPlay = true;
|
||||||
@ -119,11 +176,6 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNetStatus(TXVodPlayer txVodPlayer, Bundle bundle) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取到视频宽高回调
|
* 获取到视频宽高回调
|
||||||
*/
|
*/
|
||||||
@ -166,20 +218,8 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(url)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mTXVodPlayConfig == null) {
|
mPlayer.setMediaItem(MediaItem.fromUri(url));
|
||||||
mTXVodPlayConfig = new TXVodPlayConfig();
|
mPlayer.prepare();
|
||||||
mTXVodPlayConfig.setMaxCacheItems(15);
|
|
||||||
mTXVodPlayConfig.setProgressInterval(200);
|
|
||||||
}
|
|
||||||
if (url.endsWith(".m3u8")) {
|
|
||||||
mTXVodPlayConfig.setCacheFolderPath(null);
|
|
||||||
} else {
|
|
||||||
mTXVodPlayConfig.setCacheFolderPath(mCachePath);
|
|
||||||
}
|
|
||||||
mPlayer.setConfig(mTXVodPlayConfig);
|
|
||||||
if (mPlayer != null) {
|
|
||||||
mPlayer.startPlay(url);
|
|
||||||
}
|
|
||||||
VideoHttpUtil.videoWatchStart(videoBean.getUid(), videoBean.getId());
|
VideoHttpUtil.videoWatchStart(videoBean.getUid(), videoBean.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +228,7 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
*/
|
*/
|
||||||
public void stopPlay() {
|
public void stopPlay() {
|
||||||
if (mPlayer != null) {
|
if (mPlayer != null) {
|
||||||
mPlayer.stopPlay(false);
|
mPlayer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +237,8 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
*/
|
*/
|
||||||
private void replay() {
|
private void replay() {
|
||||||
if (mPlayer != null) {
|
if (mPlayer != null) {
|
||||||
mPlayer.seek(0);
|
mPlayer.seekTo(0);
|
||||||
mPlayer.resume();
|
mPlayer.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +246,8 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_START);
|
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_START);
|
||||||
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_END);
|
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_END);
|
||||||
if (mPlayer != null) {
|
if (mPlayer != null) {
|
||||||
mPlayer.stopPlay(false);
|
mPlayer.stop();
|
||||||
mPlayer.setPlayListener(null);
|
mPlayer.release();
|
||||||
}
|
}
|
||||||
mPlayer = null;
|
mPlayer = null;
|
||||||
mActionListener = null;
|
mActionListener = null;
|
||||||
@ -229,7 +269,7 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
public void resumePlay() {
|
public void resumePlay() {
|
||||||
if (mPaused) {
|
if (mPaused) {
|
||||||
if (!mClickPaused && mPlayer != null) {
|
if (!mClickPaused && mPlayer != null) {
|
||||||
mPlayer.resume();
|
mPlayer.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mPaused = false;
|
mPaused = false;
|
||||||
@ -263,7 +303,7 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
}
|
}
|
||||||
if (mPlayer != null) {
|
if (mPlayer != null) {
|
||||||
if (mClickPaused) {
|
if (mClickPaused) {
|
||||||
mPlayer.resume();
|
mPlayer.play();
|
||||||
} else {
|
} else {
|
||||||
mPlayer.pause();
|
mPlayer.pause();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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:id="@+id/root"
|
android:id="@+id/root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||||
android:id="@+id/video_view"
|
android:id="@+id/placeholderView"
|
||||||
|
app:surface_type="texture_view"
|
||||||
|
app:use_controller="false"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_centerInParent="true" />
|
android:layout_centerInParent="true" />
|
||||||
@ -14,7 +18,7 @@
|
|||||||
android:id="@+id/video_cover"
|
android:id="@+id/video_cover"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#000" />
|
android:background="@color/transparent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btn_play"
|
android:id="@+id/btn_play"
|
||||||
|
Loading…
Reference in New Issue
Block a user