Commit 52e38547 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added flag to ignore audio stream input (otherwise playr stuck in infinity buffering status

parent ee5dbb91
...@@ -13,9 +13,12 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController ...@@ -13,9 +13,12 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.google.android.exoplayer2.ExoPlayerFactory import com.google.android.exoplayer2.ExoPlayerFactory
import com.google.android.exoplayer2.SimpleExoPlayer import com.google.android.exoplayer2.SimpleExoPlayer
import com.google.android.exoplayer2.ext.rtmp.RtmpDataSourceFactory import com.google.android.exoplayer2.ext.rtmp.RtmpDataSourceFactory
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
import com.google.android.exoplayer2.extractor.ts.DefaultTsPayloadReaderFactory
import com.google.android.exoplayer2.source.MediaSource import com.google.android.exoplayer2.source.MediaSource
import com.google.android.exoplayer2.source.ProgressiveMediaSource import com.google.android.exoplayer2.source.ProgressiveMediaSource
import com.google.android.exoplayer2.source.hls.DefaultHlsDataSourceFactory import com.google.android.exoplayer2.source.hls.DefaultHlsDataSourceFactory
import com.google.android.exoplayer2.source.hls.DefaultHlsExtractorFactory
import com.google.android.exoplayer2.source.hls.HlsMediaSource import com.google.android.exoplayer2.source.hls.HlsMediaSource
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
...@@ -168,12 +171,12 @@ class WebCamScreenController : ...@@ -168,12 +171,12 @@ class WebCamScreenController :
val sourceUrl = viewState.camList.first{it.index == viewState.selectedCamIndex}.streams val sourceUrl = viewState.camList.first{it.index == viewState.selectedCamIndex}.streams
.first().hls .first().hls
var rtmpUrl = viewState.camList.first{it.index == viewState.selectedCamIndex}.streams // var rtmpUrl = viewState.camList.first{it.index == viewState.selectedCamIndex}.streams
.first().rtmp // .first().rtmp
// rtmpUrl = "rtmp://room-park.ru:1935/cam2-360/stream" // rtmpUrl = "rtmp://room-park.ru:1935/cam2-360/stream"
// Timber.d("source url : ${Uri.parse(rtmpUrl)}") // Timber.d("source url : ${Uri.parse(rtmpUrl)}")
// val mediaSource = buildMediaSource(Uri.parse(sourceUrl)) val mediaSource = buildMediaSource(Uri.parse(sourceUrl))
val mediaSource = buildRtmps(Uri.parse(rtmpUrl)) // val mediaSource = buildRtmps(Uri.parse(rtmpUrl))
Timber.d("source url : ${Uri.parse(sourceUrl)}") Timber.d("source url : ${Uri.parse(sourceUrl)}")
Timber.d("mediaSource : $mediaSource") Timber.d("mediaSource : $mediaSource")
player.prepare(mediaSource,true,true) player.prepare(mediaSource,true,true)
...@@ -189,7 +192,11 @@ class WebCamScreenController : ...@@ -189,7 +192,11 @@ class WebCamScreenController :
private fun buildMediaSource(uri: Uri): MediaSource { private fun buildMediaSource(uri: Uri): MediaSource {
val source = DefaultDataSourceFactory(activity,"ua") val source = DefaultDataSourceFactory(activity,"ua")
val dataSourceFactory = DefaultHlsDataSourceFactory(source)//.createDataSource(DATA_TYPE_DRM) val dataSourceFactory = DefaultHlsDataSourceFactory(source)//.createDataSource(DATA_TYPE_DRM)
val extr = DefaultHlsExtractorFactory(DefaultTsPayloadReaderFactory.FLAG_IGNORE_AAC_STREAM,true)
(DefaultTsPayloadReaderFactory.FLAG_ALLOW_NON_IDR_KEYFRAMES)
return HlsMediaSource.Factory(dataSourceFactory) return HlsMediaSource.Factory(dataSourceFactory)
.setExtractorFactory(extr)
.setAllowChunklessPreparation(true) .setAllowChunklessPreparation(true)
.createMediaSource(uri) .createMediaSource(uri)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment