集成完直播后提交代码
This commit is contained in:
1
LiveBasic/live_pull_rts/.gitignore
vendored
Normal file
1
LiveBasic/live_pull_rts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
46
LiveBasic/live_pull_rts/build.gradle
Normal file
46
LiveBasic/live_pull_rts/build.gradle
Normal file
@@ -0,0 +1,46 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdkVersion
|
||||
buildToolsVersion androidBuildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion androidMinSdkVersion
|
||||
targetSdkVersion androidTargetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation externalAndroidDesign
|
||||
|
||||
implementation externalSimpleZXing
|
||||
|
||||
implementation externalRtsSDK
|
||||
// Add a downgraded version of the player sdk for the live project single build.
|
||||
if ("true".equalsIgnoreCase(allInOne)) {
|
||||
implementation externalPlayerFull
|
||||
implementation externalARTC
|
||||
} else {
|
||||
implementation externalPlayerFullDowngrade
|
||||
implementation externalARTCDowngrade
|
||||
}
|
||||
|
||||
implementation project(':LiveCommon:live_commonbiz')
|
||||
}
|
||||
0
LiveBasic/live_pull_rts/consumer-rules.pro
Normal file
0
LiveBasic/live_pull_rts/consumer-rules.pro
Normal file
21
LiveBasic/live_pull_rts/src/main/AndroidManifest.xml
Normal file
21
LiveBasic/live_pull_rts/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.alivc.live.baselive_pull_rts">
|
||||
|
||||
<application>
|
||||
<activity android:name=".InputRtsUrlActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AVLiveTheme"/>
|
||||
<activity
|
||||
android:name=".RtsPlayActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AVLiveTheme" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.alivc.live.baselive_pull_rts;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.acker.simplezxing.activity.CaptureActivity;
|
||||
import com.alivc.live.commonui.utils.StatusBarUtil;
|
||||
|
||||
/**
|
||||
* URL 输入界面
|
||||
*/
|
||||
public class InputRtsUrlActivity extends AppCompatActivity {
|
||||
|
||||
private static final int REQ_CODE_PERMISSION = 0x1111;
|
||||
|
||||
private ImageView mBackImageView;
|
||||
private EditText mUrlEditText;
|
||||
private ImageView mIconImageView;
|
||||
private TextView mStartPlayTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.translucent(this, Color.TRANSPARENT);
|
||||
|
||||
setContentView(R.layout.activity_input_rts_url);
|
||||
|
||||
initView();
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mBackImageView = findViewById(R.id.iv_back);
|
||||
mUrlEditText = findViewById(R.id.et_url);
|
||||
mIconImageView = findViewById(R.id.iv_icon);
|
||||
mStartPlayTextView = findViewById(R.id.tv_start_play);
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
mBackImageView.setOnClickListener(view -> finish());
|
||||
|
||||
mUrlEditText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
changeState();
|
||||
}
|
||||
});
|
||||
|
||||
mStartPlayTextView.setOnClickListener(view -> {
|
||||
String url = mUrlEditText.getText().toString();
|
||||
if (!urlEditTextIsEmpty()) {
|
||||
Intent intent = new Intent(InputRtsUrlActivity.this,RtsPlayActivity.class);
|
||||
intent.putExtra("rts_url",url);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
//二维码扫描
|
||||
mIconImageView.setOnClickListener(view -> {
|
||||
if (urlEditTextIsEmpty()) {
|
||||
if (ContextCompat.checkSelfPermission(InputRtsUrlActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
|
||||
// Do not have the permission of camera, request it.
|
||||
ActivityCompat.requestPermissions(InputRtsUrlActivity.this, new String[]{Manifest.permission.CAMERA}, REQ_CODE_PERMISSION);
|
||||
} else {
|
||||
// Have gotten the permission
|
||||
startCaptureActivityForResult();
|
||||
}
|
||||
} else {
|
||||
mUrlEditText.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void changeState() {
|
||||
if (urlEditTextIsEmpty()) {
|
||||
mIconImageView.setImageResource(R.drawable.scan_icon);
|
||||
mStartPlayTextView.setTextColor(getResources().getColor(R.color.text_ultraweak));
|
||||
mStartPlayTextView.setBackgroundResource(R.drawable.shape_rts_rect_enable_blue);
|
||||
} else {
|
||||
mIconImageView.setImageResource(R.drawable.ic_close);
|
||||
mStartPlayTextView.setTextColor(getResources().getColor(R.color.text_strong));
|
||||
mStartPlayTextView.setBackgroundResource(R.drawable.shape_rts_rect_unable_blue);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean urlEditTextIsEmpty() {
|
||||
return TextUtils.isEmpty(mUrlEditText.getText().toString());
|
||||
}
|
||||
|
||||
private void startCaptureActivityForResult() {
|
||||
Intent intent = new Intent(InputRtsUrlActivity.this, CaptureActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(CaptureActivity.KEY_NEED_BEEP, CaptureActivity.VALUE_BEEP);
|
||||
bundle.putBoolean(CaptureActivity.KEY_NEED_VIBRATION, CaptureActivity.VALUE_VIBRATION);
|
||||
bundle.putBoolean(CaptureActivity.KEY_NEED_EXPOSURE, CaptureActivity.VALUE_NO_EXPOSURE);
|
||||
bundle.putByte(CaptureActivity.KEY_FLASHLIGHT_MODE, CaptureActivity.VALUE_FLASHLIGHT_OFF);
|
||||
bundle.putByte(CaptureActivity.KEY_ORIENTATION_MODE, CaptureActivity.VALUE_ORIENTATION_AUTO);
|
||||
bundle.putBoolean(CaptureActivity.KEY_SCAN_AREA_FULL_SCREEN, CaptureActivity.VALUE_SCAN_AREA_FULL_SCREEN);
|
||||
bundle.putBoolean(CaptureActivity.KEY_NEED_SCAN_HINT_TEXT, CaptureActivity.VALUE_SCAN_HINT_TEXT);
|
||||
intent.putExtra(CaptureActivity.EXTRA_SETTING_BUNDLE, bundle);
|
||||
startActivityForResult(intent, CaptureActivity.REQ_CODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == CaptureActivity.REQ_CODE) {
|
||||
switch (resultCode) {
|
||||
case RESULT_OK:
|
||||
if (mUrlEditText != null) {
|
||||
mUrlEditText.setText(data.getStringExtra(CaptureActivity.EXTRA_SCAN_RESULT));
|
||||
}
|
||||
break;
|
||||
case RESULT_CANCELED:
|
||||
if (data != null && mUrlEditText != null) {
|
||||
// for some reason camera is not working correctly
|
||||
mUrlEditText.setText(data.getStringExtra(CaptureActivity.EXTRA_SCAN_RESULT));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.alivc.live.baselive_pull_rts;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alivc.live.commonui.utils.StatusBarUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 播放界面
|
||||
*/
|
||||
public class RtsPlayActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "RtsPlayActivity";
|
||||
|
||||
private RtsPlayer mRtsPlayer;
|
||||
private RadioGroup mRadioGroup;
|
||||
private TextView mTraceIdTextView;
|
||||
private ImageView mBackImageView;
|
||||
private SurfaceView mSurfaceView;
|
||||
private TextView mErrorTextView;
|
||||
private LinearLayout mMaskLinearLayout;
|
||||
private TextView mDemoteTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//设置屏幕常亮
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
StatusBarUtil.translucent(this, Color.TRANSPARENT);
|
||||
|
||||
setContentView(R.layout.activity_rts_play);
|
||||
|
||||
mRtsPlayer = new RtsPlayer(this);
|
||||
String mRtsUrl = getIntent().getStringExtra("rts_url");
|
||||
|
||||
initView();
|
||||
initListener();
|
||||
|
||||
mRtsPlayer.setDataSource(mRtsUrl);
|
||||
mRtsPlayer.prepare();
|
||||
setRadioGroupEnabled(false);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mBackImageView = findViewById(R.id.iv_back);
|
||||
mErrorTextView = findViewById(R.id.tv_error);
|
||||
mRadioGroup = findViewById(R.id.radio_group);
|
||||
mDemoteTextView = findViewById(R.id.tv_demote);
|
||||
mMaskLinearLayout = findViewById(R.id.ll_mask);
|
||||
mSurfaceView = findViewById(R.id.surface_view);
|
||||
mTraceIdTextView = findViewById(R.id.tv_trace_id);
|
||||
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
mBackImageView.setOnClickListener(view -> finish());
|
||||
mRadioGroup.setOnCheckedChangeListener((radioGroup, checkedId) -> {
|
||||
if (checkedId == R.id.rb_play) {
|
||||
mRtsPlayer.prepare();
|
||||
setRadioGroupEnabled(false);
|
||||
} else {
|
||||
mRtsPlayer.stop();
|
||||
}
|
||||
});
|
||||
|
||||
//show traceId
|
||||
mTraceIdTextView.setOnClickListener(view -> showTraceIdInfo());
|
||||
|
||||
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||
@Override
|
||||
public void surfaceCreated(@NonNull SurfaceHolder surfaceHolder) {
|
||||
mRtsPlayer.setSurface(surfaceHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(@NonNull SurfaceHolder surfaceHolder, int i, int i1, int i2) {
|
||||
mRtsPlayer.surfaceChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(@NonNull SurfaceHolder surfaceHolder) {
|
||||
mRtsPlayer.setSurface(null);
|
||||
}
|
||||
});
|
||||
|
||||
mRtsPlayer.setRtsPlayerListener(new RtsPlayer.RtsPlayerListener() {
|
||||
@Override
|
||||
public void onFirstFrameRender() {
|
||||
mErrorTextView.setText("");
|
||||
mMaskLinearLayout.setVisibility(View.GONE);
|
||||
setRadioGroupEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(String msg, int code) {
|
||||
Log.e(TAG, "onPlayerError: " + msg + " --- " + code);
|
||||
setRadioGroupEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRtsMsg(String msg, int code, boolean showDemoted) {
|
||||
showRtsMsg(msg, code, showDemoted);
|
||||
setRadioGroupEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showTraceIdInfo() {
|
||||
RtsTraceIdInfoView rtsTraceIdInfoView = new RtsTraceIdInfoView(this);
|
||||
if (mRtsPlayer != null) {
|
||||
rtsTraceIdInfoView.setTraceId(mRtsPlayer.getTraceId());
|
||||
rtsTraceIdInfoView.setUrl(mRtsPlayer.getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
//Rts 事件通知
|
||||
private void showRtsMsg(String msg, int code, boolean showDemoted) {
|
||||
mRadioGroup.check(R.id.rb_stop);
|
||||
if (mMaskLinearLayout.getVisibility() == View.GONE) {
|
||||
mMaskLinearLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//降级文案显示、隐藏
|
||||
mDemoteTextView.setVisibility(showDemoted ? View.VISIBLE : View.GONE);
|
||||
mErrorTextView.setText(String.format(Locale.getDefault(), "%d,%s", code, msg));
|
||||
}
|
||||
|
||||
private void setRadioGroupEnabled(boolean enable) {
|
||||
for (int i = 0; i < mRadioGroup.getChildCount(); i++) {
|
||||
mRadioGroup.getChildAt(i).setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mRtsPlayer != null) {
|
||||
mRtsPlayer.stop();
|
||||
mRtsPlayer.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
package com.alivc.live.baselive_pull_rts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import com.aliyun.player.AliPlayer;
|
||||
import com.aliyun.player.AliPlayerFactory;
|
||||
import com.aliyun.player.IPlayer;
|
||||
import com.aliyun.player.bean.InfoCode;
|
||||
import com.aliyun.player.nativeclass.PlayerConfig;
|
||||
import com.aliyun.player.source.UrlSource;
|
||||
import com.cicada.player.utils.Logger;
|
||||
import com.alivc.live.commonbiz.BuildConfig;
|
||||
|
||||
/**
|
||||
* RTS 播放
|
||||
*/
|
||||
public class RtsPlayer {
|
||||
|
||||
static {
|
||||
if(BuildConfig.MTL_BUILD_FOR_AIO) {
|
||||
System.loadLibrary("all_in_one");
|
||||
} else {
|
||||
System.loadLibrary("RtsSDK");
|
||||
}
|
||||
}
|
||||
|
||||
private static final int TRACE_ID_CODE = 104;
|
||||
private final AliPlayer mRtsAliPlayer;
|
||||
private String mUrl;
|
||||
private String mTraceId;
|
||||
private RtsPlayerListener mRtsPlayerListener;
|
||||
private int mCurrentPlayerState;
|
||||
private boolean mEnableRetry = true;
|
||||
|
||||
public RtsPlayer(Context context) {
|
||||
//开启日志
|
||||
Logger.getInstance(context).enableConsoleLog(true);
|
||||
Logger.getInstance(context).setLogLevel(Logger.LogLevel.AF_LOG_LEVEL_TRACE);
|
||||
|
||||
mRtsAliPlayer = AliPlayerFactory.createAliPlayer(context);
|
||||
//自动播放
|
||||
mRtsAliPlayer.setAutoPlay(true);
|
||||
mRtsAliPlayer.setOnInfoListener(infoBean -> {
|
||||
if (infoBean.getCode() == InfoCode.DirectComponentMSG) {
|
||||
String extraMsg = infoBean.getExtraMsg();
|
||||
parseDirectComponentMSG(extraMsg);
|
||||
}
|
||||
});
|
||||
|
||||
mRtsAliPlayer.setOnStateChangedListener((newState) -> {
|
||||
mCurrentPlayerState = newState;
|
||||
});
|
||||
|
||||
mRtsAliPlayer.setOnRenderingStartListener(() -> {
|
||||
if (mRtsPlayerListener != null) {
|
||||
mRtsPlayerListener.onFirstFrameRender();
|
||||
}
|
||||
});
|
||||
|
||||
mRtsAliPlayer.setOnErrorListener(errorInfo -> {
|
||||
if (mRtsPlayerListener != null) {
|
||||
mRtsPlayerListener.onPlayerError(errorInfo.getMsg(), errorInfo.getCode().getValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 给播放器设置 Surface
|
||||
*/
|
||||
public void setSurface(SurfaceHolder surface) {
|
||||
mRtsAliPlayer.setDisplay(surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置播放源
|
||||
*/
|
||||
public void setDataSource(String url) {
|
||||
this.mUrl = url;
|
||||
UrlSource urlSource = new UrlSource();
|
||||
urlSource.setUri(mUrl);
|
||||
PlayerConfig config = mRtsAliPlayer.getConfig();
|
||||
//播放器配置
|
||||
if (mUrl.startsWith("artc://")) {
|
||||
config.mMaxDelayTime = 1000;
|
||||
config.mHighBufferDuration = 10;
|
||||
config.mStartBufferDuration = 10;
|
||||
} else {
|
||||
config.mMaxDelayTime = 10000;
|
||||
config.mHighBufferDuration = 100;
|
||||
config.mStartBufferDuration = 100;
|
||||
}
|
||||
mRtsAliPlayer.setConfig(config);
|
||||
mRtsAliPlayer.setDataSource(urlSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备播放
|
||||
*/
|
||||
public void prepare() {
|
||||
mRtsAliPlayer.prepare();
|
||||
}
|
||||
|
||||
public void surfaceChanged() {
|
||||
mRtsAliPlayer.surfaceChanged();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
mRtsAliPlayer.stop();
|
||||
}
|
||||
|
||||
public void release() {
|
||||
mUrl = null;
|
||||
mRtsAliPlayer.release();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 Rts 事件
|
||||
*/
|
||||
private void parseDirectComponentMSG(String msg) {
|
||||
if (msg.contains("code=" + RtsError.E_DNS_FAIL.getCode()) || msg.contains("code=" + RtsError.E_AUTH_FAIL.getCode())
|
||||
|| msg.contains("code=" + RtsError.E_CONN_TIMEOUT.getCode()) || msg.contains("code=" + RtsError.E_SUB_TIMEOUT.getCode())
|
||||
|| msg.contains("code=" + RtsError.E_SUB_NO_STREAM.getCode()) || msg.contains("code=" + RtsError.E_STREAM_BROKEN.getCode())
|
||||
|| msg.contains("code=" + RtsError.E_RECV_STOP_SIGNAL.getCode())) {
|
||||
|
||||
//不是播放状态,降级
|
||||
if (mCurrentPlayerState != IPlayer.started) {
|
||||
willBeDemoted();
|
||||
} else {
|
||||
//播放状态,收到 STREAM_BROKEN 事件并且未重试,则重试
|
||||
if (msg.contains("code=" + RtsError.E_STREAM_BROKEN.getCode()) && mEnableRetry) {
|
||||
retry();
|
||||
} else {
|
||||
parseError(msg);
|
||||
//除 stop 信令以外的其他失败消息,才会降级
|
||||
if (!msg.contains("code=" + RtsError.E_RECV_STOP_SIGNAL.getCode())) {
|
||||
willBeDemoted();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (msg.contains("code=" + TRACE_ID_CODE)) {
|
||||
parseTraceId(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试
|
||||
*/
|
||||
private void retry() {
|
||||
prepare();
|
||||
mEnableRetry = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 降级策略
|
||||
*/
|
||||
private void willBeDemoted() {
|
||||
stop();
|
||||
if (mUrl.startsWith("artc://")) {
|
||||
setDataSource(mUrl.replace("artc://", "rtmp://"));
|
||||
prepare();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 Rts 事件,并通知上层监听
|
||||
*/
|
||||
private void parseError(String msg) {
|
||||
if (mRtsPlayerListener != null) {
|
||||
if (msg.contains("code=" + RtsError.E_DNS_FAIL.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_DNS_FAIL.name(), RtsError.E_DNS_FAIL.getCode(), true);
|
||||
} else if (msg.contains("code=" + RtsError.E_AUTH_FAIL.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_AUTH_FAIL.name(), RtsError.E_AUTH_FAIL.getCode(), true);
|
||||
} else if (msg.contains("code=" + RtsError.E_CONN_TIMEOUT.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_CONN_TIMEOUT.name(), RtsError.E_CONN_TIMEOUT.getCode(), true);
|
||||
} else if (msg.contains("code=" + RtsError.E_SUB_TIMEOUT.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_SUB_TIMEOUT.name(), RtsError.E_SUB_TIMEOUT.getCode(), true);
|
||||
} else if (msg.contains("code=" + RtsError.E_SUB_NO_STREAM.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_SUB_NO_STREAM.name(), RtsError.E_SUB_NO_STREAM.getCode(), true);
|
||||
} else if (msg.contains("code=" + RtsError.E_STREAM_BROKEN.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_STREAM_BROKEN.name(), RtsError.E_STREAM_BROKEN.getCode(), true);
|
||||
} else if (msg.contains("code=" + RtsError.E_RECV_STOP_SIGNAL.getCode())) {
|
||||
mRtsPlayerListener.onRtsMsg(RtsError.E_RECV_STOP_SIGNAL.name(), RtsError.E_RECV_STOP_SIGNAL.getCode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 TraceId
|
||||
*/
|
||||
private void parseTraceId(String msg) {
|
||||
String[] split = msg.split("-sub-");
|
||||
if (split.length >= 1) {
|
||||
mTraceId = "RequestId:" + (split[1].substring(0, split[1].length() - 1));
|
||||
mTraceId = mTraceId.replace("\"", "").replace("\\", "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 TraceId
|
||||
*/
|
||||
public String getTraceId() {
|
||||
return mTraceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 URL
|
||||
*/
|
||||
public String getUrl() {
|
||||
return mUrl;
|
||||
}
|
||||
|
||||
public void setRtsPlayerListener(RtsPlayerListener listener) {
|
||||
this.mRtsPlayerListener = listener;
|
||||
}
|
||||
|
||||
public interface RtsPlayerListener {
|
||||
/**
|
||||
* 首帧显示回调
|
||||
*/
|
||||
void onFirstFrameRender();
|
||||
|
||||
/**
|
||||
* 播放器报错
|
||||
*/
|
||||
void onPlayerError(String msg, int code);
|
||||
|
||||
/**
|
||||
* Rts 事件
|
||||
*/
|
||||
void onRtsMsg(String msg, int code, boolean showDemoted);
|
||||
}
|
||||
|
||||
public enum RtsError {
|
||||
/**
|
||||
* DNS 解析失败
|
||||
*/
|
||||
E_DNS_FAIL(20001),
|
||||
/**
|
||||
* 鉴权失败
|
||||
*/
|
||||
E_AUTH_FAIL(20002),
|
||||
/**
|
||||
* 建联信令超时
|
||||
*/
|
||||
E_CONN_TIMEOUT(20011),
|
||||
/**
|
||||
* 订阅信令返回错误,或者超时。
|
||||
*/
|
||||
E_SUB_TIMEOUT(20012),
|
||||
/**
|
||||
* 订阅流不存在
|
||||
*/
|
||||
E_SUB_NO_STREAM(20013),
|
||||
/**
|
||||
* 媒体超时,没有收到音频包和视频包
|
||||
*/
|
||||
E_STREAM_BROKEN(20052),
|
||||
/**
|
||||
* 收到CDN的stop信令
|
||||
*/
|
||||
E_RECV_STOP_SIGNAL(20061);
|
||||
|
||||
private int code;
|
||||
|
||||
RtsError(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.alivc.live.baselive_pull_rts;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.alivc.live.commonui.avdialog.AUILiveDialog;
|
||||
import com.alivc.live.commonutils.ToastUtils;
|
||||
|
||||
public class RtsTraceIdInfoView extends ConstraintLayout {
|
||||
|
||||
private final View inflate;
|
||||
private Group mGroup;
|
||||
private TextView mTipsTextView;
|
||||
private TextView mTraceIdTextView;
|
||||
private TextView mCopyTextView;
|
||||
private TextView mCancelTextView;
|
||||
private AUILiveDialog mAUILiveDialog;
|
||||
private final ClipboardManager mClipboardManager;
|
||||
private String mUrl;
|
||||
private String mTraceId;
|
||||
|
||||
public RtsTraceIdInfoView(@NonNull Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public RtsTraceIdInfoView(@NonNull Context context, AttributeSet attrs) {
|
||||
this(context, attrs, -1);
|
||||
}
|
||||
|
||||
public RtsTraceIdInfoView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
inflate = LayoutInflater.from(context).inflate(R.layout.layout_rts_traceid_info, this, true);
|
||||
mClipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
initView();
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mAUILiveDialog = new AUILiveDialog(getContext());
|
||||
mAUILiveDialog.setContentView(this);
|
||||
mGroup = inflate.findViewById(R.id.group);
|
||||
mTipsTextView = inflate.findViewById(R.id.tv_tips);
|
||||
mTraceIdTextView = inflate.findViewById(R.id.tv_trace_id);
|
||||
mCopyTextView = inflate.findViewById(R.id.tv_copy);
|
||||
mCancelTextView = inflate.findViewById(R.id.tv_cancel);
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
mCancelTextView.setOnClickListener(view -> mAUILiveDialog.dismiss());
|
||||
mCopyTextView.setOnClickListener(view -> {
|
||||
mAUILiveDialog.dismiss();
|
||||
//复制
|
||||
ClipData mClipData = ClipData.newPlainText("Label", mTraceId + ";" + mUrl);
|
||||
mClipboardManager.setPrimaryClip(mClipData);
|
||||
|
||||
ToastUtils.show(getContext().getString(R.string.pull_rts_trace_id_info_copy_success));
|
||||
});
|
||||
}
|
||||
|
||||
public void setTraceId(String traceId) {
|
||||
if (TextUtils.isEmpty(traceId)) {
|
||||
mGroup.setVisibility(View.GONE);
|
||||
mTipsTextView.setText(R.string.pull_rts_trace_id_info_error);
|
||||
mCancelTextView.setText(R.string.pull_rts_trace_id_info_confirm);
|
||||
mTraceIdTextView.setText("");
|
||||
} else {
|
||||
mGroup.setVisibility(View.VISIBLE);
|
||||
mTipsTextView.setText(R.string.pull_rts_trace_id_info_success);
|
||||
mCancelTextView.setText(R.string.pull_rts_trace_id_info_confirm);
|
||||
mTraceIdTextView.setText(traceId);
|
||||
}
|
||||
this.mTraceId = traceId;
|
||||
mAUILiveDialog.show();
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.mUrl = url;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 822 B |
Binary file not shown.
|
After Width: | Height: | Size: 257 B |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/shape_rts_checked_blue" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/shape_rts_unchecked_white" android:state_checked="false" />
|
||||
<item android:drawable="@drawable/shape_rts_unchecked_white"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#00BCD4" android:state_checked="true" />
|
||||
<item android:color="#FCFCFD" android:state_checked="false" />
|
||||
<item android:color="#FCFCFD"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#4D4DCFE1"/>
|
||||
<stroke android:color="#4DCFE1" android:width="1px"/>
|
||||
<corners android:radius="24dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#00BCD4" />
|
||||
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<size android:width="48dp" android:height="24dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="16dp" />
|
||||
<solid android:color="#23262F" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:shape="rectangle"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
<solid android:color="#4D4DCFE1"/>
|
||||
<corners android:radius="24dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#4DCFE1"/>
|
||||
<corners android:radius="24dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<solid android:color="#3A3D48" />
|
||||
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<size
|
||||
android:width="92dp"
|
||||
android:height="24dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#FCFCFD" />
|
||||
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<size android:width="48dp" android:height="24dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#1C1D22">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginTop="44dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/pull_rts_enter_name"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_16"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:src="@drawable/ic_live_action_bar_back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_url_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/pull_rts_url_title"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_16"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/pull_rts_input_hint"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textColorHint="#747A8C"
|
||||
android:textSize="@dimen/alivc_common_font_14"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_icon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:theme="@style/AUIEditText"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_url_title" />
|
||||
|
||||
<View
|
||||
android:id="@+id/under_line"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#3A3D48"
|
||||
app:layout_constraintStart_toStartOf="@id/et_url"
|
||||
app:layout_constraintEnd_toEndOf="@id/et_url"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_url"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:src="@drawable/scan_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@id/et_url"
|
||||
app:layout_constraintEnd_toEndOf="@id/et_url"
|
||||
app:layout_constraintTop_toTopOf="@id/et_url" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="110dp"
|
||||
android:text="@string/pull_rts_url_generate_tip"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/under_line" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_start_play"
|
||||
android:layout_width="272dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/shape_rect_blue"
|
||||
android:gravity="center"
|
||||
android:text="@string/pull_rts_start_play"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/alivc_common_font_18"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tips" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,258 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#1C1D22">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginTop="44dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/pull_rts_enter_name"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_16"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:src="@drawable/ic_live_action_bar_back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_title" />
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surface_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="204dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_mask"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:background="@color/color_background_black_alpha_30"
|
||||
app:layout_constraintBottom_toBottomOf="@id/surface_view"
|
||||
app:layout_constraintEnd_toEndOf="@id/surface_view"
|
||||
app:layout_constraintStart_toStartOf="@id/surface_view"
|
||||
app:layout_constraintTop_toTopOf="@id/surface_view">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#F53F3F"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_demote"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#3BB346"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/pull_rts_error_demote"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="@id/surface_view"
|
||||
app:layout_constraintTop_toBottomOf="@id/surface_view">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/selector_rts_play_state"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/pull_rts_play"
|
||||
android:textColor="@drawable/selector_rts_play_state_text"
|
||||
android:textSize="@dimen/alivc_common_font_12" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_stop"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/selector_rts_play_state"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="@string/pull_rts_stop"
|
||||
android:textColor="@drawable/selector_rts_play_state_text"
|
||||
android:textSize="@dimen/alivc_common_font_12" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_trace_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_rts_trace_id_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/pull_rts_trace_id"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintEnd_toEndOf="@id/surface_view"
|
||||
app:layout_constraintTop_toTopOf="@id/radio_group" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/radio_group">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_question_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pull_rts_problem_title"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_14"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="#3A3D48"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_question_title" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_error"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="@color/colourful_ic_strong"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/divider_1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/pull_rts_problem_playback_failed"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintBottom_toBottomOf="@id/divider_error"
|
||||
app:layout_constraintStart_toEndOf="@id/divider_error"
|
||||
app:layout_constraintTop_toTopOf="@id/divider_error" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_error_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/pull_rts_problem_playback_failed_tip"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/divider_error" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_lag"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginTop="27dp"
|
||||
android:background="@color/colourful_ic_strong"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_error_msg" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/pull_rts_problem_stuck_delay"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintBottom_toBottomOf="@id/divider_lag"
|
||||
app:layout_constraintStart_toEndOf="@id/divider_lag"
|
||||
app:layout_constraintTop_toTopOf="@id/divider_lag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_step_1_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/pull_rts_problem_stuck_delay_step1_title"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/divider_lag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_step_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/pull_rts_problem_stuck_delay_step1"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_step_1_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_step_2_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/pull_rts_problem_stuck_delay_step2_title"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_step_1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_step_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/pull_rts_problem_stuck_delay_step2"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textSize="@dimen/alivc_common_font_12"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_step_2_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="312dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_rts_live_dialog_bg">
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="tv_copy" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_trace_id"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_trace_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tips"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_copy"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_copy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/pull_rts_trace_id_copy"
|
||||
android:textColor="#00BCD4"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/view_horizontal_line"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_tips"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_trace_id" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_horizontal_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#3A3D48"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
27
LiveBasic/live_pull_rts/src/main/res/values-en/strings.xml
Normal file
27
LiveBasic/live_pull_rts/src/main/res/values-en/strings.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Rts -->
|
||||
<string name="pull_rts_enter_name">Rts Live Streaming</string>
|
||||
<string name="pull_rts_url_title">URL</string>
|
||||
<string name="pull_rts_input_hint">Please enter RTS ultra-low delay playback address</string>
|
||||
<string name="pull_rts_url_generate_tip">The playback address can be generated by the address generator in the live video console</string>
|
||||
<string name="pull_rts_start_play">Start playing</string>
|
||||
<string name="pull_rts_play">Play</string>
|
||||
<string name="pull_rts_stop">Stop</string>
|
||||
<string name="pull_rts_trace_id">TraceID acquisition</string>
|
||||
<string name="pull_rts_problem_title">Common Problem</string>
|
||||
<string name="pull_rts_problem_playback_failed">Playback Failed</string>
|
||||
<string name="pull_rts_problem_playback_failed_tip">Please go to the live video console>Toolbox>Self service problem troubleshooting, and enter the URL to locate the problem of playback failure</string>
|
||||
<string name="pull_rts_problem_stuck_delay">Play stuck / high delay</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step1_title">step1</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step1">Please go to Live Video Console>Stream Management>Stream Detection to analyze whether your current streaming network environment is good (whether the frame rate or timestamp is normal)</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step2_title">step2</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step2">If your streaming network is good, please click [TraceID Acquisition] to obtain relevant information and submit a work order for help</string>
|
||||
<string name="pull_rts_trace_id_copy">Copy</string>
|
||||
<string name="pull_rts_trace_id_info_confirm">Confirm</string>
|
||||
<string name="pull_rts_trace_id_info_close">Close</string>
|
||||
<string name="pull_rts_trace_id_info_error">The network connection is not successful, and the TraceID information is not currently available</string>
|
||||
<string name="pull_rts_trace_id_info_success">If you encounter problems when experiencing Demo, please submit the following information to the after-sales service in the form of work order</string>
|
||||
<string name="pull_rts_trace_id_info_copy_success">Information copied</string>
|
||||
<string name="pull_rts_error_demote">Demote</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Rts -->
|
||||
<string name="pull_rts_enter_name">超低延时直播</string>
|
||||
<string name="pull_rts_url_title">播放地址</string>
|
||||
<string name="pull_rts_input_hint">请输入RTS超低延时播放地址</string>
|
||||
<string name="pull_rts_url_generate_tip">播放地址可到视频直播控制台用地址生成器生成</string>
|
||||
<string name="pull_rts_start_play">开始播放</string>
|
||||
<string name="pull_rts_play">播放</string>
|
||||
<string name="pull_rts_stop">停止</string>
|
||||
<string name="pull_rts_trace_id">TraceID获取</string>
|
||||
<string name="pull_rts_problem_title">常见问题</string>
|
||||
<string name="pull_rts_problem_playback_failed">播放失败</string>
|
||||
<string name="pull_rts_problem_playback_failed_tip">请前往 视频直播控制台 > 工具箱 > 自助问题排查,输入URL自助定位播放失败问题</string>
|
||||
<string name="pull_rts_problem_stuck_delay">播放卡顿/延时高</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step1_title">step1</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step1">请前往视频直播控制台 > 流管理 > 流检测,分析您当前的推流网络环境是否良好(帧率或时间戳是否正常)</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step2_title">step2</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step2">若您的推流网络良好,请点击【TraceID获取】获取相关信息,并提交工单寻求帮助</string>
|
||||
<string name="pull_rts_trace_id_copy">复制</string>
|
||||
<string name="pull_rts_trace_id_info_confirm">确认</string>
|
||||
<string name="pull_rts_trace_id_info_close">关闭</string>
|
||||
<string name="pull_rts_trace_id_info_error">网络建联不成功,当前未获取到TraceID信息</string>
|
||||
<string name="pull_rts_trace_id_info_success">若您在体验Demo时碰到问题,请将以下信息通过工单的形式提交给售后</string>
|
||||
<string name="pull_rts_trace_id_info_copy_success">信息已复制</string>
|
||||
<string name="pull_rts_error_demote">降级</string>
|
||||
</resources>
|
||||
7
LiveBasic/live_pull_rts/src/main/res/values/dimens.xml
Normal file
7
LiveBasic/live_pull_rts/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="alivc_common_font_12">12sp</dimen>
|
||||
<dimen name="alivc_common_font_14">14sp</dimen>
|
||||
<dimen name="alivc_common_font_16">16sp</dimen>
|
||||
<dimen name="alivc_common_font_18">18sp</dimen>
|
||||
</resources>
|
||||
27
LiveBasic/live_pull_rts/src/main/res/values/strings.xml
Normal file
27
LiveBasic/live_pull_rts/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Rts -->
|
||||
<string name="pull_rts_enter_name">Rts Live Streaming</string>
|
||||
<string name="pull_rts_url_title">URL</string>
|
||||
<string name="pull_rts_input_hint">Please enter RTS ultra-low delay playback address</string>
|
||||
<string name="pull_rts_url_generate_tip">The playback address can be generated by the address generator in the live video console</string>
|
||||
<string name="pull_rts_start_play">Start playing</string>
|
||||
<string name="pull_rts_play">Play</string>
|
||||
<string name="pull_rts_stop">Stop</string>
|
||||
<string name="pull_rts_trace_id">TraceID acquisition</string>
|
||||
<string name="pull_rts_problem_title">Common Problem</string>
|
||||
<string name="pull_rts_problem_playback_failed">Playback Failed</string>
|
||||
<string name="pull_rts_problem_playback_failed_tip">Please go to the live video console>Toolbox>Self service problem troubleshooting, and enter the URL to locate the problem of playback failure</string>
|
||||
<string name="pull_rts_problem_stuck_delay">Play stuck / high delay</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step1_title">step1</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step1">Please go to Live Video Console>Stream Management>Stream Detection to analyze whether your current streaming network environment is good (whether the frame rate or timestamp is normal)</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step2_title">step2</string>
|
||||
<string name="pull_rts_problem_stuck_delay_step2">If your streaming network is good, please click [TraceID Acquisition] to obtain relevant information and submit a work order for help</string>
|
||||
<string name="pull_rts_trace_id_copy">Copy</string>
|
||||
<string name="pull_rts_trace_id_info_confirm">Confirm</string>
|
||||
<string name="pull_rts_trace_id_info_close">Close</string>
|
||||
<string name="pull_rts_trace_id_info_error">The network connection is not successful, and the TraceID information is not currently available</string>
|
||||
<string name="pull_rts_trace_id_info_success">If you encounter problems when experiencing Demo, please submit the following information to the after-sales service in the form of work order</string>
|
||||
<string name="pull_rts_trace_id_info_copy_success">Information copied</string>
|
||||
<string name="pull_rts_error_demote">Demote</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user