Unable to get video size of m3u8 stream
Description
I tried to get the video size in pixel using the code below. It work with flv stream but not with m3u8 stream.
Expected behavior
Get the size of the video in pixel.
Actual behavior
- flv: able to get the video size
- m3u8: return VideoTrack but the with and height is 0
Steps to reproduce
File: https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8
Code you used
mediaPlayer.setEventListener(
new MediaPlayer.EventListener() {
@Override
public void onEvent(MediaPlayer.Event event) {
// Current video track is only available when the media is playing
int height = 0;
int width = 0;
Media.VideoTrack currentVideoTrack = mediaPlayer.getCurrentVideoTrack();
if (currentVideoTrack != null) {
height = currentVideoTrack.height;
width = currentVideoTrack.width;
}
}
}
);
Context
- Question: Is there a native method that returns the size of video instead of the solution above?
- Size is important to me because I have to calculate the scale, aspect ratio and the size of the container to put the video.
libvlc version
implementation 'org.videolan.android:libvlc-all:3.5.0-eap5'
Android version
Android 11