Skip to content

RTMP - Player transitions to STATE_ENDED before stream ends #4337

@jinfanzon

Description

@jinfanzon

Hi, I've recently implemented the RTMP exo player extension, and the stream is correct, but randomly after a certain amount of time the screen freezes, with no exception being thrown. After adding some logs, I can see the the player listener onPlayerStateChanged is triggered with state ENDED. I'm appending a section of my code

This is how I initialize the player:

`

@OverRide

        public void onResponse(Call call, Response response) throws IOException {

            RtmpDataSourceFactory rtmpDataSourceFactory = new RtmpDataSourceFactory();

            MediaSource mediaSource = new ExtractorMediaSource.Factory(rtmpDataSourceFactory)
                    .createMediaSource(Utils.streamURLGenerator(
                            response.body().string(),
                            findChannel(PreferenceUtils.getStringPreferences("CHANNEL", "")).getId()));

            player.prepare(mediaSource, true, true);

            player.setPlayWhenReady(true);
        }

`

This is how the URL is being created:

`

public static Uri streamURLGenerator(String loadBalancerUrl, String channel)

{

    return Uri.parse("http://"+loadBalancerUrl+":1935/live/"+channel+" live=1");

}

`

Why is it going to state ENDED? Is there a workaround to recover or avoid this state?

I'll be appending in an email the stream url.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions