Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTMP - Player transitions to STATE_ENDED before stream ends #4337

Closed
jinfanzon opened this issue Jun 1, 2018 · 2 comments
Closed

RTMP - Player transitions to STATE_ENDED before stream ends #4337

jinfanzon opened this issue Jun 1, 2018 · 2 comments
Assignees

Comments

@jinfanzon
Copy link

jinfanzon commented Jun 1, 2018

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.

@jinfanzon jinfanzon reopened this Jun 1, 2018
@ojw28
Copy link
Contributor

ojw28 commented Jun 4, 2018

I found some simpler reproduction steps involving toggling airplane mode on and off again. This appears to be an issue in LibRtmp rather than ExoPlayer, which I've reported here: ant-media/LibRtmp-Client-for-Android#69

@ojw28 ojw28 self-assigned this Jun 4, 2018
@ojw28 ojw28 changed the title RTMP - Stream freeze RTMP - Player transitions to STATE_ENDED before stream ends Jun 4, 2018
@ojw28
Copy link
Contributor

ojw28 commented Jun 4, 2018

The only workaround I can think of, until the root cause is fixed in the dependency, is to listen for state changes to the ended state, and re-prepare the player when such a transition occurs.

vavadhani referenced this issue in ittiam-systems/LibRtmp-Client-for-Android Jun 21, 2019
Propagate the error codes from RTMP read to nativeRead function and
return errors as expected. This commit also corrects exception throws
from nativeRead.
@ojw28 ojw28 closed this as completed Sep 1, 2019
@google google locked and limited conversation to collaborators Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants