Search in sources :

Example 1 with StreamType

use of org.schabi.newpipe.extractor.stream.StreamType in project NewPipe by TeamNewPipe.

the class VideoPlayer method onMetadataChanged.

protected void onMetadataChanged(@NonNull final PlayQueueItem item, @Nullable final StreamInfo info, final int newPlayQueueIndex, final boolean hasPlayQueueItemChanged) {
    qualityTextView.setVisibility(View.GONE);
    playbackSpeedTextView.setVisibility(View.GONE);
    playbackEndTime.setVisibility(View.GONE);
    playbackLiveSync.setVisibility(View.GONE);
    final StreamType streamType = info == null ? StreamType.NONE : info.getStreamType();
    switch(streamType) {
        case AUDIO_STREAM:
            surfaceView.setVisibility(View.GONE);
            playbackEndTime.setVisibility(View.VISIBLE);
            break;
        case AUDIO_LIVE_STREAM:
            surfaceView.setVisibility(View.GONE);
            playbackLiveSync.setVisibility(View.VISIBLE);
            break;
        case LIVE_STREAM:
            surfaceView.setVisibility(View.VISIBLE);
            playbackLiveSync.setVisibility(View.VISIBLE);
            break;
        case VIDEO_STREAM:
            if (info.getVideoStreams().size() + info.getVideoOnlyStreams().size() == 0)
                break;
            final List<VideoStream> videos = ListHelper.getSortedStreamVideosList(context, info.getVideoStreams(), info.getVideoOnlyStreams(), false);
            availableStreams = new ArrayList<>(videos);
            if (playbackQuality == null) {
                selectedStreamIndex = getDefaultResolutionIndex(videos);
            } else {
                selectedStreamIndex = getOverrideResolutionIndex(videos, getPlaybackQuality());
            }
            buildQualityMenu();
            qualityTextView.setVisibility(View.VISIBLE);
            surfaceView.setVisibility(View.VISIBLE);
        default:
            playbackEndTime.setVisibility(View.VISIBLE);
            break;
    }
    buildPlaybackSpeedMenu();
    playbackSpeedTextView.setVisibility(View.VISIBLE);
}
Also used : StreamType(org.schabi.newpipe.extractor.stream.StreamType) VideoStream(org.schabi.newpipe.extractor.stream.VideoStream)

Aggregations

StreamType (org.schabi.newpipe.extractor.stream.StreamType)1 VideoStream (org.schabi.newpipe.extractor.stream.VideoStream)1