@@ -17,9 +17,11 @@ import com.tencent.iot.explorer.link.demo.R
1717import com.tencent.iot.explorer.link.demo.common.customView.CalendarView
1818import com.tencent.iot.explorer.link.demo.common.customView.timeline.TimeLineView
1919import com.tencent.iot.explorer.link.demo.common.customView.timeline.TimeLineViewChangeListener
20+ import com.tencent.iot.explorer.link.demo.common.log.L
2021import com.tencent.iot.explorer.link.demo.common.util.CommonUtils
2122import com.tencent.iot.explorer.link.demo.core.entity.BaseResponse
2223import com.tencent.iot.explorer.link.demo.core.entity.VideoHistory
24+ import com.tencent.iot.explorer.link.demo.video.Command
2325import com.tencent.iot.explorer.link.demo.video.DevInfo
2426import com.tencent.iot.explorer.link.demo.video.playback.CalendarDialog
2527import com.tencent.iot.explorer.link.demo.video.playback.CalendarDialog.OnClickedListener
@@ -67,6 +69,7 @@ class VideoCloudPlaybackFragment: VideoPlaybackBaseFragment(), TextureView.Surfa
6769 private var isShowing = false
6870 private lateinit var surface: Surface
6971 private var player : IjkMediaPlayer = IjkMediaPlayer ()
72+ var audioPlayer: IjkMediaPlayer ? = null
7073 @Volatile
7174 private var updateSeekBarAble = true // 手动拖拽过程的标记
7275
@@ -192,8 +195,8 @@ class VideoCloudPlaybackFragment: VideoPlaybackBaseFragment(), TextureView.Surfa
192195 iv_start?.setImageResource(R .mipmap.start)
193196 pause_tip_layout?.visibility = View .VISIBLE
194197 seekBarJob?.cancel()
195- video_seekbar.progress = video_seekbar.max
196- player.seekTo(1 )
198+ // video_seekbar.progress = video_seekbar.max
199+ // player.seekTo(1)
197200 }
198201 }
199202
@@ -311,7 +314,7 @@ class VideoCloudPlaybackFragment: VideoPlaybackBaseFragment(), TextureView.Surfa
311314 override fun success (response : String? , reqCode : Int ) {
312315 var json = JSONObject .parseObject(response)
313316 Log .d(" 响应mjpeg===>url" , response)
314- Log .d(tag, " 响应mjpeg===>url= ${response} end " )
317+
315318 json?.let {
316319 it.getJSONObject(" Response" )?.let {
317320 var eventResp = JSONObject .parseObject(it.toJSONString(), SignedMJPEGUrlResponse ::class .java)
@@ -328,6 +331,7 @@ class VideoCloudPlaybackFragment: VideoPlaybackBaseFragment(), TextureView.Surfa
328331 }
329332
330333 private fun startMJPEGVideo (vUrl : String , aUrl : String ) {
334+ Log .d(tag, " 响应mjpeg===>vUrl=${vUrl} \n and aURL===>${aUrl} " )
331335 player.reset()
332336 player.setSurface(this .surface)
333337 player.dataSource = vUrl
@@ -352,6 +356,34 @@ class VideoCloudPlaybackFragment: VideoPlaybackBaseFragment(), TextureView.Surfa
352356 }
353357 }
354358 }
359+
360+ audioPlayer?.release()
361+ audioPlayer = IjkMediaPlayer ()
362+ audioPlayer?.let {
363+ val url = aUrl
364+ it.reset()
365+
366+ // it.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "analyzemaxduration", 100)
367+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_FORMAT , " probesize" , 512 )
368+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_PLAYER , " packet-buffering" , 0 )
369+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_PLAYER , " start-on-prepared" , 1 )
370+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_CODEC , " threads" , 1 )
371+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_PLAYER , " sync-av-start" , 0 )
372+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_PLAYER , " mediacodec" ,1 )
373+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_PLAYER , " mediacodec-auto-rotate" , 1 )
374+ it.setOption(IjkMediaPlayer .OPT_CATEGORY_PLAYER , " mediacodec-handle-resolution-change" , 1 )
375+ //
376+ // it.setFrameSpeed(1.5f)
377+ // while (!::surface.isInitialized) {
378+ // delay(50)
379+ // L.e("delay for waiting surface.")
380+ // }
381+ it.setSurface(surface)
382+ it.dataSource = url
383+
384+ it.prepareAsync()
385+ it.start()
386+ }
355387 }
356388
357389 private fun startVideo (url : String , offset : Long ) {
0 commit comments