In Xamarin Forms audio not Playing for a .m3u8 Video Live Stream
Summary
I try to Play .m3u8 Live Stream in Xamarin Forms using VLC, it's Video shows fine but there is no Audio. Tried on both Android and iOS, same result. Tried the same .m3u8 URL in VLC for Mac, it works fine some times means there is audio in there and some times there is no audio there as well.
Minimal project and steps to reproduce
var url = "http://someurl.m3u8"; media = new Media(LibVLC, url, FromType.FromLocation); mediaPlayer = new MediaPlayer(media) { EnableHardwareDecoding = true }; Player.MediaPlayer = mediaPlayer; Player.MediaPlayer.Play();
What is the current bug behavior?
No Audio to listen but Video is there. I have tried adding avcodec option as well media.AddOption(":codec=avcodec"); but no use, same result.
What is the expected correct behavior?
There should be audio on Android and iOS for the stream.
Does it work on other plaforms? Does it work with the official VLC apps?
I have tried the stream url on VLC for Mac Version 3.0.8 Vetinari (Intel 64 bit), it gives audio some times and some times it does not too. I have tried it on official latest VLC app from PlayStore and there is no audio there as well.
Relevant logs and/or screenshots
These Logs are from the Xamarin Forms (Android) Application Output Console
[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_new_location'.
```[Mono] Probing 'libvlc_media_new_location'.
```[Mono] Found as 'libvlc_media_new_location'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_new_path'.
```[Mono] Probing 'libvlc_media_new_path'.
```[Mono] Found as 'libvlc_media_new_path'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_new_as_node'.
```[Mono] Probing 'libvlc_media_new_as_node'.
```[Mono] Found as 'libvlc_media_new_as_node'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_add_option'.
```[Mono] Probing 'libvlc_media_add_option'.
```[Mono] Found as 'libvlc_media_add_option'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_player_new_from_media'.
```[Mono] Probing 'libvlc_media_player_new_from_media'.
```[Mono] Found as 'libvlc_media_player_new_from_media'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_player_set_android_context'.
```[Mono] Probing 'libvlc_media_player_set_android_context'.
```[Mono] Found as 'libvlc_media_player_set_android_context'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_player_play'.
```[Mono] Probing 'libvlc_media_player_play'.
```[Mono] Found as 'libvlc_media_player_play'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_player_get_media'.
```[Mono] Probing 'libvlc_media_player_get_media'.
```[Mono] Found as 'libvlc_media_player_get_media'.
```[Mono] DllImport searching in: 'libvlc' ('libvlc.so').
```[Mono] Searching for 'libvlc_media_player_get_state'.
```[Mono] Probing 'libvlc_media_player_get_state'.
```[Mono] Found as 'libvlc_media_player_get_state'.
```[Mono] DllImport searching in: '__Internal' ('(null)').
```[Mono] Searching for 'java_interop_jnienv_call_float_method_a'.
```[Mono] Probing 'java_interop_jnienv_call_float_method_a'.
```[Mono] Found as 'java_interop_jnienv_call_float_method_a'.
```[VideoCapabilities] Unrecognized profile/level 1/32 for video/mp4v-es
```[VideoCapabilities] Unrecognized profile/level 32768/2 for video/mp4v-es
```[VideoCapabilities] Unrecognized profile/level 32768/64 for video/mp4v-es
```[VLC] [7a9dc6b0/1c58] libvlc packetizer: AAC channels: 2 samplerate: 48000
```[android_audiotr] type=1400 audit(0.0:41): avc: denied { read } for name="u:object_r:dolby_prop:s0" dev="tmpfs" ino=10020 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:dolby_prop:s0 tclass=file permissive=0
```[libc] Access denied finding property "dolby.dma.minbufcnt"
```[AudioTrack] min buf count is limited to 2 times HAL buf
```[VideoCapabilities] Unsupported mime video/dolby-vision
```[VideoCapabilities] Unsupported mime video/dolby-vision
```[VideoCapabilities] Unsupported mime video/dolby-vision
```[AmazonAudioTrackCallback] No AudioTrackFlags provided. Using internal defaults.
```[VideoCapabilities] Unsupported mime video/dolby-vision
```[AmazonAudioTrackCallback] No Audio content type provided.
```[VideoCapabilities] Unsupported mime video/dolby-vision
```[android.media.AudioTrack] AUDIOINFO: audio_input: format: 2 sample_rate: 48000 channels: 2 AudioAttributes: AudioAttributes: usage=1 content=2 flags=0x0 tags= bundle=null
```[libc] Access denied finding property "dolby.dma.minbufcnt"
```[android_audiotr] type=1400 audit(0.0:42): avc: denied { read } for name="u:object_r:dolby_prop:s0" dev="tmpfs" ino=10020 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:dolby_prop:s0 tclass=file permissive=0
```[AudioTrack] min buf count is limited to 2 times HAL buf
```[VideoCapabilities] Unsupported mime video/dolby-vision
```[AudioTrack] Client defaulted notificationFrames to 1026 for frameCount 3080
```[VideoCapabilities] Unrecognized profile/level 0/0 for video/mpeg2
```[VideoCapabilities] Unrecognized profile/level 0/2 for video/mpeg2
```[VideoCapabilities] Unrecognized profile/level 0/3 for video/mpeg2
```[VideoCapabilities] Unsupported profile 4 for video/mp4v-es
```[VLC] [84dd3e30/1c5f] libvlc window: request 1 not implemented
```[VLC] [84dd3e30/1c5f] libvlc window: request 1 not implemented
```[VLC] [84dd3eb0/1c5f] libvlc gl: shader 0: Success.
```[VLC] [84dd3eb0/1c5f] libvlc gl: shader 1: Success.
```[VLC] [84dd3eb0/1c5f] libvlc gl: shader 0: Success.
```[VLC] [84dd3eb0/1c5f] libvlc gl: shader 1: Success.
```[VLC] [84dd3e30/1c5f] libvlc window: request 0 not implemented
```[VLC] [84dd3e30/1c5f] libvlc window: request 0 not implemented
```[VLC] [84dd3e30/1c5f] libvlc window: request 1 not implemented
```[OMXClient] MuxOMX ctor
```[MediaCodec] [OMX.MTK.VIDEO.DECODER.AVC] setting surface generation to 6743041
```[MediaCodecLogger] [ASAP] HW.video.avc P2 + 668836
```[ACodec_vendorExt] Setting OMX_IndexParamVideoHWComposed
```[ACodec_vendorExt] Error OMX_IndexParamVideoHWComposed: Unknown error 1010 (1010)
```[MediaCodecLogger] [ASAP] HW.video.avc P2 - 668845
```[MediaCodecLogger] Got a Service. Calling PID = 6585
```[MediaCodecLogger] [ASAP] HW.video.avc P3 + 668845
```[SurfaceUtils] set up nativeWindow 0x797fa008 for 640x368, color 0x7f000001, rotation 0, usage 0x2933
```[ACodec] [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 8 failed: -2147483648
```[ACodec] [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 7 failed: -2147483648
```[MediaCodecLogger] [ASAP] HW.video.avc P3 - 668857
```[MediaCodecLogger] [ASAP] HW.video.avc Got First Input Frame 668859
```[AHierarchicalStateMachine] Warning message AMessage(what = 'omxI') = {
```[AHierarchicalStateMachine] int32_t type = 0
```[AHierarchicalStateMachine] int32_t event = 3
```[AHierarchicalStateMachine] int32_t data1 = 1
```[AHierarchicalStateMachine] int32_t data2 = 117440527
```[AHierarchicalStateMachine] } unhandled in root state.
```[SurfaceUtils] set up nativeWindow 0x797fa008 for 1920x1088, color 0x7f000001, rotation 0, usage 0x2933
```[ACodec] [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 15 failed: -2147483648
```[ACodec] [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 14 failed: -2147483648
```[MediaCodecLogger] updateFormatChanged width = 640 height = 360
```[VLC] [7a9dce30/1c6d] libvlc decoder: output: 2130706433 unknown, 1920x1088 stride 1920 1088, crop 0 0 0 0
```[MediaCodecLogger] updatePTSTime [HW.video.avc] First PTS after Flush or reset = 2417260012
```[MediaCodecLogger] [ASAP] HW.video.avc Got First Frame Ready 668934
```[MediaCodecLogger] [ASAP] HW.video.avc Got First Frame Render 668935
```[MediaCodecLogger] App uses Timestamps for AVSync
```[MTK_IMGX] MTK EGL_IMGX Max (2147483647 x 2147483647)
```[VLC] [84dd3e30/1c5f] libvlc window: request 3 not implemented
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 73
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc Resolution change from 0x0 to 640x360 took = 3
```[VLC] [85191830/1c42] libvlc input: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms)
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 0
```[MediaCodecLogger] Flushing: com.android.mediaplayer.HW.video.avc.framerate = 4.321 fps
```[NdkMediaCodec] sf error code: -38
```[MediaCodecLogger] updatePTSTime [HW.video.avc] First PTS after Flush or reset = 2422260012
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 45
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 438
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 183
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc Dropping frame
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc Dropping frame
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc Dropping frame
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc Dropping frame
```[MediaCodecLogger] updatePTSTime Possible seek found!
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 397
```[MediaCodecLogger] com.android.mediaplayer.HW.video.avc.bitrateInKbps = 326
These screenshot are from the VLC for Mac Version 3.0.8 Vetinari (Intel 64 bit), that I took while the stream was not giving the audio but just video. If screenshots are not visible, below are the details in it: MEDIA INFORMATION
Codec Information: Stream 0: Original ID 256 Codec H264 - MPEG-4 AVC (part 10) (h264) Type Video Video resolution 640360 Buffer dimension 640368 Frame rate 50 Decode format Orientation Top left Chroma location Left Stream 1: Orignal ID 257 Codec ADTS Type Audio Channels Stereo Sample rate 48000 Hz Bits per sample 32
Statistics: Input: Read at media 9451 KiB Input bitrate 568 kb/s Demuxed 8067 KiB Stream bitrate 483 kb/s Video: Decoded blocks 12250 Displayed frames 5932 Lost frames 239 Audio: Decoded blocks 11474 Played buffers 0 Lost Buffers 5736
Environment
- OS: Android
- Version Android 9, iOS 13.2.2
- Device: Huawei P20 lite
- LibVLCSharp version 3.4.2
- LibVLCSharp.Forms version 3.4.2
- VideoLAN.LibVLC.Android version 3.2.0