|
@@ -11,8 +11,8 @@ import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
|
-import com.tencent.liteav.demo.superplayer.SuperPlayerModel
|
|
|
-import com.yingyangfly.baselib.config.AccountConfig
|
|
|
+import com.tencent.rtmp.TXLiveConstants
|
|
|
+import com.tencent.rtmp.TXVodPlayer
|
|
|
import com.yingyangfly.baselib.db.GameSoundBean
|
|
|
import com.yingyangfly.baselib.db.VoicePlayerBean
|
|
|
import com.yingyangfly.baselib.dialog.GameLoadingDialog
|
|
@@ -44,6 +44,8 @@ class GameIntroductionActivity :
|
|
|
private var gameCode: String = ""
|
|
|
private var playClass: String = ""
|
|
|
private var gameBean: GameBean? = null
|
|
|
+ private var mVodPlayer: TXVodPlayer? = null
|
|
|
+
|
|
|
/**
|
|
|
* 语音合成
|
|
|
*/
|
|
@@ -54,6 +56,7 @@ class GameIntroductionActivity :
|
|
|
gameCode = intent.getStringExtra("gameCode") ?: ""
|
|
|
playClass = intent.getStringExtra("playClass") ?: ""
|
|
|
voicePlayer = VoicePlayer.getInstance(mContext)
|
|
|
+ mVodPlayer = TXVodPlayer(mContext)
|
|
|
if (isEnterGame.not()) {
|
|
|
val gameLoadingDialog = GameLoadingDialog()
|
|
|
gameLoadingDialog.onDialogClickListener = {
|
|
@@ -79,7 +82,9 @@ class GameIntroductionActivity :
|
|
|
override fun onNewIntent(intent: Intent?) {
|
|
|
super.onNewIntent(intent)
|
|
|
isEnterGame = true
|
|
|
- binding.playTxCloudView.onResume()
|
|
|
+ if (mVodPlayer != null) {
|
|
|
+ mVodPlayer?.resume()
|
|
|
+ }
|
|
|
binding.btnStartGame.setBackgroundResource(R.mipmap.icon_game_continue)
|
|
|
}
|
|
|
|
|
@@ -108,17 +113,23 @@ class GameIntroductionActivity :
|
|
|
}
|
|
|
|
|
|
override fun onDestroy() {
|
|
|
- binding.playTxCloudView.resetPlayer()
|
|
|
super.onDestroy()
|
|
|
+ if (mVodPlayer != null) {
|
|
|
+ mVodPlayer?.stopPlay(true)
|
|
|
+ }
|
|
|
+ binding.videoView.onDestroy()
|
|
|
+
|
|
|
}
|
|
|
|
|
|
override fun onPause() {
|
|
|
- binding.playTxCloudView.onPause()
|
|
|
if (voicePlayer != null) {
|
|
|
if (voicePlayer!!.isPlaying) {
|
|
|
voicePlayer?.stop()
|
|
|
}
|
|
|
}
|
|
|
+ if (mVodPlayer != null) {
|
|
|
+ mVodPlayer?.pause()
|
|
|
+ }
|
|
|
super.onPause()
|
|
|
}
|
|
|
|
|
@@ -308,12 +319,12 @@ class GameIntroductionActivity :
|
|
|
* 加载游戏视频
|
|
|
*/
|
|
|
private fun loadVideo(url: String) {
|
|
|
- binding {
|
|
|
- val model = SuperPlayerModel()
|
|
|
- model.appId = AccountConfig.TENCENT_APPID // 配置 AppId
|
|
|
- model.url = url // 配置您的播放视频 url
|
|
|
- binding.playTxCloudView.showOrHideBackBtn(false)
|
|
|
- binding.playTxCloudView.playWithModelNeedLicence(model)
|
|
|
+ if (mVodPlayer != null) {
|
|
|
+ mVodPlayer?.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN)
|
|
|
+ mVodPlayer?.setPlayerView(binding.videoView)
|
|
|
+ mVodPlayer?.isLoop = true
|
|
|
+ mVodPlayer?.setMute(true)
|
|
|
+ mVodPlayer?.startVodPlay(url)
|
|
|
}
|
|
|
}
|
|
|
|