Registration of HLS requests

I want to track switching between different bitrates in an HLS stream in Android. So I was thinking about tracking HLS requests. and disassemble them. Do you guys know how I'm going to walk and do this?

I've already tried tracking video footage, but I don't think that will be enough ...

        vv.setVideoPath("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8");
        vv.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mMediaPlayer = mp;
                mMediaPlayer.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {
                    @Override
                    public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
                        Log.e(TAG, "perhaps changed bitrate?");
                    }
                });
            }
        });
        vv.start();

      

Any ideas are more than welcome.

+3


source to share


1 answer


Unfortunately this cannot be done with the android.media.MediaPlayer API. There is no news in the onVideoSizeChanged () callback. You might be lucky enough to check the android.media.MediaPlayer.OnInfoListener callback with the MEDIA_INFO_BUFFERING_START event and its optional, but the behavior varies depending on the manufacturer.



My suggestion is to switch to the new ExoPlayer , an open source project created by Google. In the latest release, it handles HLS . Through the HlsChunkSource class , you can get information about all chunk requests (for example, using the getChunkOperation () method).

+1


source







All Articles