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

Exo Player 2.1.1 stuck in buffering state after enabling webVTT closed captions #2424

Closed
andrei1990 opened this issue Feb 6, 2017 · 1 comment
Assignees
Labels

Comments

@andrei1990
Copy link

andrei1990 commented Feb 6, 2017

When trying to enable closed captions for Apple master playlist advanced or other HLS test streams the video is buffering and sometimes it stuck in this state. In order to make the video play again you should go and disable captions and enable them again and video resumes then.

Version used: 2.1.1
Devices: Samsung Galaxy S3 , OS 4.3, Nexus 5, OS 6.0

Also this is happening with ours hls streams that has vtt embeded captions.


@Override
    public void setCaptionsState(boolean disabled) {
        if (closedCaptionsRendererIndex != -1) {
            trackSelector.setRendererDisabled(closedCaptionsRendererIndex, disabled);
            if (!disabled) {
                enableCaptions();
            } else {
                trackSelector.clearSelectionOverrides(closedCaptionsRendererIndex);
            }
        }


    }


    private void enableCaptions() {
        TrackGroupArray trackGroups = trackSelector.getCurrentMappedTrackInfo().getTrackGroups(closedCaptionsRendererIndex);
        if (selectionOverride != null) {
            setSelectionOverride(closedCaptionsRendererIndex, trackGroups, selectionOverride);
            return;
        }
        for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
            TrackGroup group = trackGroups.get(groupIndex);
            for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
                if (foundPreferredClosedCaptionsTrackIndex(MimeTypes.BASE_TYPE_TEXT, groupIndex, trackIndex, trackGroups, group))
                    return;
            }
        }
        for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
            TrackGroup group = trackGroups.get(groupIndex);
            for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
                if (foundPreferredClosedCaptionsTrackIndex(MimeTypes.BASE_TYPE_APPLICATION, groupIndex, trackIndex, trackGroups, group))
                    return;
            }
        }
    }

    private boolean foundPreferredClosedCaptionsTrackIndex(String mimeType, int groupIndex, int trackIndex, TrackGroupArray trackGroups, TrackGroup group) {
        Format format = group.getFormat(trackIndex);
        String formatMimeType = format.sampleMimeType;
        if (!(TextUtils.isEmpty(formatMimeType)) && formatMimeType.startsWith(mimeType)) {
            selectionOverride = new MappingTrackSelector.SelectionOverride(FIXED_FACTORY, groupIndex, trackIndex);
            setSelectionOverride(closedCaptionsRendererIndex, trackGroups, selectionOverride);
            return true;
        }
        return false;
    }

    private void setSelectionOverride(int rendererIndex, TrackGroupArray trackGroupArray, MappingTrackSelector.SelectionOverride selectionOverride) {
        trackSelector.setSelectionOverride(rendererIndex, trackGroupArray, selectionOverride);
    }

@AquilesCanta AquilesCanta self-assigned this Feb 6, 2017
@AquilesCanta
Copy link
Contributor

A fix for this will be available in the next push.

ojw28 pushed a commit that referenced this issue Mar 13, 2017
Without this, it is possible that a non timestamp master instances
the adjuster with its own chunk start time. When chunks are not
aligned, this breaks adjustment.

Issue:#2424

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149764488
@ojw28 ojw28 closed this as completed Mar 23, 2017
@google google locked and limited conversation to collaborators Aug 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants