当前位置: 首页>>代码示例>>Java>>正文


Java MappingTrackSelector.SelectionOverride方法代码示例

本文整理汇总了Java中com.google.android.exoplayer2.trackselection.MappingTrackSelector.SelectionOverride方法的典型用法代码示例。如果您正苦于以下问题:Java MappingTrackSelector.SelectionOverride方法的具体用法?Java MappingTrackSelector.SelectionOverride怎么用?Java MappingTrackSelector.SelectionOverride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer2.trackselection.MappingTrackSelector的用法示例。


在下文中一共展示了MappingTrackSelector.SelectionOverride方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSelectedTrackIndex

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
public int getSelectedTrackIndex(@NonNull RendererType type) {
    // Retrieves the available tracks
    int exoPlayerTrackIndex = getExoPlayerTrackType(type);
    MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    TrackGroupArray trackGroupArray = mappedTrackInfo == null ? null : mappedTrackInfo.getTrackGroups(exoPlayerTrackIndex);
    if (trackGroupArray == null || trackGroupArray.length == 0) {
        return -1;
    }

    // Verifies the track selection has been overridden
    MappingTrackSelector.SelectionOverride selectionOverride = trackSelector.getSelectionOverride(exoPlayerTrackIndex, trackGroupArray);
    if (selectionOverride == null || selectionOverride.groupIndex != exoPlayerTrackIndex || selectionOverride.length <= 0) {
        return -1;
    }

    return selectionOverride.tracks[0];
}
 
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:18,代码来源:ExoMediaPlayer.java

示例2: setSelectedTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
public void setSelectedTrack(@NonNull RendererType type, int index) {
    // Retrieves the available tracks
    int exoPlayerTrackIndex = getExoPlayerTrackType(type);
    MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    TrackGroupArray trackGroupArray = mappedTrackInfo == null ? null : mappedTrackInfo.getTrackGroups(exoPlayerTrackIndex);
    if (trackGroupArray == null || trackGroupArray.length == 0) {
        return;
    }

    // Creates the track selection override
    int[] tracks = new int[] {index};
    TrackSelection.Factory factory = tracks.length == 1 ? new FixedTrackSelection.Factory() : adaptiveTrackSelectionFactory;
    MappingTrackSelector.SelectionOverride selectionOverride = new MappingTrackSelector.SelectionOverride(factory, exoPlayerTrackIndex, tracks);

    // Specifies the correct track to use
    trackSelector.setSelectionOverride(exoPlayerTrackIndex, trackGroupArray, selectionOverride);
}
 
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:18,代码来源:ExoMediaPlayer.java

示例3: getTracksRemoving

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
private static int[] getTracksRemoving(@NonNull MappingTrackSelector.SelectionOverride override, int removedTrack) {
    int[] tracks = new int[override.length - 1];
    int trackCount = 0;
    for (int i = 0; i < tracks.length + 1; i++) {
        int track = override.tracks[i];
        if (track != removedTrack) {
            tracks[trackCount++] = track;
        }
    }
    return tracks;
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:12,代码来源:TubiQualityDialogView.java

示例4: selectAudioTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
public boolean selectAudioTrack(PlayerAudioTrack audioTrack, RendererTypeRequester rendererTypeRequester) {
    TrackGroupArray trackGroups = trackSelector.trackGroups(AUDIO, rendererTypeRequester);

    MappingTrackSelector.SelectionOverride selectionOverride = new MappingTrackSelector.SelectionOverride(
            trackSelectionFactory,
            audioTrack.groupIndex(),
            audioTrack.formatIndex()
    );
    return trackSelector.setSelectionOverride(AUDIO, rendererTypeRequester, trackGroups, selectionOverride);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:11,代码来源:ExoPlayerAudioTrackSelector.java

示例5: setSelectionOverride

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
boolean setSelectionOverride(TrackType trackType,
                             RendererTypeRequester rendererTypeRequester,
                             TrackGroupArray trackGroups,
                             MappingTrackSelector.SelectionOverride selectionOverride) {
    Optional<Integer> rendererIndex = rendererTrackIndexExtractor.extract(trackType, mappedTrackInfoLength(), rendererTypeRequester);
    if (rendererIndex.isPresent()) {
        trackSelector.setSelectionOverride(rendererIndex.get(), trackGroups, selectionOverride);
        return true;
    } else {
        return false;
    }
}
 
开发者ID:novoda,项目名称:no-player,代码行数:13,代码来源:ExoPlayerTrackSelector.java

示例6: selectVideoTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
public boolean selectVideoTrack(PlayerVideoTrack videoTrack, RendererTypeRequester rendererTypeRequester) {
    TrackGroupArray trackGroups = trackSelector.trackGroups(VIDEO, rendererTypeRequester);

    MappingTrackSelector.SelectionOverride selectionOverride = new MappingTrackSelector.SelectionOverride(
            trackSelectionFactory,
            videoTrack.groupIndex(),
            videoTrack.formatIndex()
    );
    return trackSelector.setSelectionOverride(VIDEO, rendererTypeRequester, trackGroups, selectionOverride);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:11,代码来源:ExoPlayerVideoTrackSelector.java

示例7: selectTextTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
public boolean selectTextTrack(PlayerSubtitleTrack subtitleTrack, RendererTypeRequester rendererTypeRequester) {
    TrackGroupArray trackGroups = trackSelector.trackGroups(TEXT, rendererTypeRequester);

    MappingTrackSelector.SelectionOverride selectionOverride = new MappingTrackSelector.SelectionOverride(
            trackSelectionFactory,
            subtitleTrack.groupIndex(),
            subtitleTrack.formatIndex()
    );
    return trackSelector.setSelectionOverride(TEXT, rendererTypeRequester, trackGroups, selectionOverride);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:11,代码来源:ExoPlayerSubtitleTrackSelector.java

示例8: givenTrackSelectorContainsTracks_whenSelectingAudioTrack_thenSelectsTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
@Test
public void givenTrackSelectorContainsTracks_whenSelectingAudioTrack_thenSelectsTrack() {
    TrackGroupArray trackGroups = givenTrackSelectorContainsTracks();

    ArgumentCaptor<MappingTrackSelector.SelectionOverride> argumentCaptor = whenSelectingAudioTrack(trackGroups);

    MappingTrackSelector.SelectionOverride selectionOverride = argumentCaptor.getValue();
    assertThat(selectionOverride.factory).isEqualTo(trackSelectionFactory);
    assertThat(selectionOverride.groupIndex).isEqualTo(SECOND_GROUP);
    assertThat(selectionOverride.tracks).contains(THIRD_TRACK);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:12,代码来源:ExoPlayerAudioTrackSelectorTest.java

示例9: whenSelectingAudioTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
private ArgumentCaptor<MappingTrackSelector.SelectionOverride> whenSelectingAudioTrack(TrackGroupArray trackGroups) {
    exoPlayerAudioTrackSelector.selectAudioTrack(AUDIO_TRACK, rendererTypeRequester);

    ArgumentCaptor<MappingTrackSelector.SelectionOverride> argumentCaptor = ArgumentCaptor.forClass(MappingTrackSelector.SelectionOverride.class);
    verify(trackSelector).setSelectionOverride(eq(TrackType.AUDIO), any(RendererTypeRequester.class), eq(trackGroups), argumentCaptor.capture());
    return argumentCaptor;
}
 
开发者ID:novoda,项目名称:no-player,代码行数:8,代码来源:ExoPlayerAudioTrackSelectorTest.java

示例10: givenTrackSelectorContainsTracks_whenSelectingVideoTrack_thenSelectsTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
@Test
public void givenTrackSelectorContainsTracks_whenSelectingVideoTrack_thenSelectsTrack() {
    givenTrackSelectorContainsTracks();

    ArgumentCaptor<MappingTrackSelector.SelectionOverride> argumentCaptor = whenSelectingVideoTrack(ADDITIONAL_PLAYER_VIDEO_TRACK);

    MappingTrackSelector.SelectionOverride selectionOverride = argumentCaptor.getValue();
    assertThat(selectionOverride.factory).isEqualTo(trackSelectionFactory);
    assertThat(selectionOverride.groupIndex).isEqualTo(FIRST_GROUP);
    assertThat(selectionOverride.tracks).contains(SECOND_TRACK);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:12,代码来源:ExoPlayerVideoTrackSelectorTest.java

示例11: whenSelectingVideoTrack

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
private ArgumentCaptor<MappingTrackSelector.SelectionOverride> whenSelectingVideoTrack(PlayerVideoTrack videoTrack) {
    exoPlayerVideoTrackSelector.selectVideoTrack(videoTrack, rendererTypeRequester);

    ArgumentCaptor<MappingTrackSelector.SelectionOverride> argumentCaptor = ArgumentCaptor.forClass(MappingTrackSelector.SelectionOverride.class);
    verify(trackSelector).setSelectionOverride(eq(TrackType.VIDEO), any(RendererTypeRequester.class), any(TrackGroupArray.class), argumentCaptor.capture());
    return argumentCaptor;
}
 
开发者ID:novoda,项目名称:no-player,代码行数:8,代码来源:ExoPlayerVideoTrackSelectorTest.java

示例12: onClick

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
@Override
public void onClick(View view) {

    if (view == qualityAutoView) {
        isDisabled = false;
        override = null;
    } else {
        isDisabled = false;
        @SuppressWarnings("unchecked")
        Pair<Integer, Integer> tag = (Pair<Integer, Integer>) view.getTag();
        if(tag==null){
            Toast.makeText(getContext(),"this format is not supported ",Toast.LENGTH_SHORT).show();
            return;
        }
        int groupIndex = tag.first;
        int trackIndex = tag.second;
        if (!trackGroupsAdaptive[groupIndex] || override == null
                || override.groupIndex != groupIndex) {
            override = new MappingTrackSelector.SelectionOverride(FIXED_FACTORY, groupIndex, trackIndex);
        } else {
            // The group being modified is adaptive and we already have a non-null override.
            boolean isEnabled = ((TubiRadioButton) view).isChecked();
            int overrideLength = override.length;
            if (isEnabled) {
                // Remove the track from the override.
                if (overrideLength == 1) {
                    // The last track is being removed, so the override becomes empty.
                    override = null;
                    isDisabled = true;
                } else {
                    setOverride(groupIndex, getTracksRemoving(override, trackIndex));
                }
            } else {
                // Add the track to the override.
                setOverride(groupIndex, getTracksAdding(override, trackIndex));
            }
        }
    }
    // Update the views with the new state.
    updateViews();
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:42,代码来源:TubiQualityDialogView.java

示例13: setOverride

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
private void setOverride(int group, int[] tracks) {
    TrackSelection.Factory factory = tracks.length == 1 ? FIXED_FACTORY
            : adaptiveTrackSelectionFactory;
    override = new MappingTrackSelector.SelectionOverride(factory, group, tracks);
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:6,代码来源:TubiQualityDialogView.java

示例14: getTracksAdding

import com.google.android.exoplayer2.trackselection.MappingTrackSelector; //导入方法依赖的package包/类
private static int[] getTracksAdding(@NonNull MappingTrackSelector.SelectionOverride override, int addedTrack) {
    int[] tracks = override.tracks;
    tracks = Arrays.copyOf(tracks, tracks.length + 1);
    tracks[tracks.length - 1] = addedTrack;
    return tracks;
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:7,代码来源:TubiQualityDialogView.java


注:本文中的com.google.android.exoplayer2.trackselection.MappingTrackSelector.SelectionOverride方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。