[Fix]解决视频流功能问题
This commit is contained in:
@@ -36,7 +36,7 @@ class CameraListAdapter : Adapter<CameraListAdapter.CameraListHolder> {
|
||||
data?.let {
|
||||
val cameraEntity = it[position]
|
||||
holder.cameraInfo.text = with(cameraEntity) {
|
||||
if (!isCarLive()) "${roadName}${crossingName}${getHeadingStr()}" else "${street}${township}"
|
||||
if (!isCarLive()) "${crossingName}${headingDesc}${getHeadingStr()}" else "${street}${township}"
|
||||
}
|
||||
holder.bottomLine.visibility =
|
||||
if (it.size - 1 == position) View.INVISIBLE else View.VISIBLE
|
||||
|
||||
@@ -23,8 +23,12 @@ import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import kotlinx.android.synthetic.main.view_camera_list.view.*
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
import java.lang.Exception
|
||||
|
||||
/**
|
||||
@@ -88,16 +92,14 @@ class CameraListView : FrameLayout {
|
||||
if (cameraEntity is CameraEntity) {
|
||||
when {
|
||||
!cameraEntity.isCarLive() -> {
|
||||
// 开启摄像头推流
|
||||
cameraEntity.ip?.let { ip ->
|
||||
// 华哥那边现在只支持一个ip"183.242.46.150",现在不用这一套
|
||||
// CallerMonitorManager.openCameraStream(ip)
|
||||
// 测试一直打开的顺义摄像头,不需要调接口让摄像头开启推流,现在走这一套流程
|
||||
if (!cameraEntity.flvUrl.isNullOrEmpty()) {
|
||||
gsyVideoPlay(cameraEntity.flvUrl!!)
|
||||
} else {
|
||||
Logger.e(TAG, "视频播放地址为空!")
|
||||
}
|
||||
if (!cameraEntity.flvUrl.isNullOrEmpty()) {
|
||||
Logger.d(TAG, "播放地址为:${cameraEntity.flvUrl!!},ip为:${cameraEntity.ip}")
|
||||
gsyVideoPlay(cameraEntity.flvUrl!!)
|
||||
} else if (!cameraEntity.ip.isNullOrEmpty()) {
|
||||
Logger.d(TAG, "打开推流的摄像头ip为:${cameraEntity.ip}")
|
||||
CallerMonitorManager.openCameraStream(cameraEntity.ip!!)
|
||||
} else {
|
||||
Logger.e(TAG, "摄像头视频播放地址和ip均为空")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
@@ -132,7 +134,12 @@ class CameraListView : FrameLayout {
|
||||
isPlaySuccess = false
|
||||
isFirstPage = true
|
||||
}
|
||||
val list: MutableList<VideoOptionModel> = ArrayList()
|
||||
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "reconnect", 3))
|
||||
GSYVideoManager.instance().optionModelList = list
|
||||
GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL)
|
||||
PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
||||
IjkPlayerManager.setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG)
|
||||
svpPlayer.setPlayListener(object : SimpleVideoPlayer.PlayListener {
|
||||
override fun onPlayEvent(event: Int) {
|
||||
Logger.d(TAG, "onPlayEvent: event is:$event")
|
||||
@@ -284,6 +291,8 @@ class CameraListView : FrameLayout {
|
||||
gsyVideoOptionBuilder.setUrl(flvUrl)
|
||||
.setCacheWithPlay(false)
|
||||
.setAutoFullWithSize(false)
|
||||
.setIsTouchWigetFull(false)
|
||||
.setIsTouchWiget(false)
|
||||
.setPlayTag(TAG).build(svpPlayer)
|
||||
svpPlayer.startButton.performClick()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user