Java Code Examples for com.google.android.exoplayer2.trackselection.TrackSelectionArray#get()
The following examples show how to use
com.google.android.exoplayer2.trackselection.TrackSelectionArray#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultLoadControl.java From MediaSDK with Apache License 2.0 | 5 votes |
/** * Calculate target buffer size in bytes based on the selected tracks. The player will try not to * exceed this target buffer. Only used when {@code targetBufferBytes} is {@link C#LENGTH_UNSET}. * * @param renderers The renderers for which the track were selected. * @param trackSelectionArray The selected tracks. * @return The target buffer size in bytes. */ protected int calculateTargetBufferSize( Renderer[] renderers, TrackSelectionArray trackSelectionArray) { int targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelectionArray.get(i) != null) { targetBufferSize += getDefaultBufferSize(renderers[i].getTrackType()); } } return targetBufferSize; }
Example 2
Source File: DefaultLoadControl.java From MediaSDK with Apache License 2.0 | 5 votes |
private static boolean hasVideo(Renderer[] renderers, TrackSelectionArray trackSelectionArray) { for (int i = 0; i < renderers.length; i++) { if (renderers[i].getTrackType() == C.TRACK_TYPE_VIDEO && trackSelectionArray.get(i) != null) { return true; } } return false; }
Example 3
Source File: DefaultLoadControl.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Calculate target buffer size in bytes based on the selected tracks. The player will try not to * exceed this target buffer. Only used when {@code targetBufferBytes} is {@link C#LENGTH_UNSET}. * * @param renderers The renderers for which the track were selected. * @param trackSelectionArray The selected tracks. * @return The target buffer size in bytes. */ protected int calculateTargetBufferSize( Renderer[] renderers, TrackSelectionArray trackSelectionArray) { int targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelectionArray.get(i) != null) { targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType()); } } return targetBufferSize; }
Example 4
Source File: DefaultLoadControl.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Calculate target buffer size in bytes based on the selected tracks. The player will try not to * exceed this target buffer. Only used when {@code targetBufferBytes} is {@link C#LENGTH_UNSET}. * * @param renderers The renderers for which the track were selected. * @param trackSelectionArray The selected tracks. * @return The target buffer size in bytes. */ protected int calculateTargetBufferSize( Renderer[] renderers, TrackSelectionArray trackSelectionArray) { int targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelectionArray.get(i) != null) { targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType()); } } return targetBufferSize; }
Example 5
Source File: ExoVideoView.java From ExoVideoView with Apache License 2.0 | 5 votes |
private void updateForCurrentTrackSelections() { if (player == null) { return; } TrackSelectionArray selections = player.getCurrentTrackSelections(); for (int i = 0; i < selections.length; i++) { if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) { // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in // onRenderedFirstFrame(). hideArtwork(); return; } } // Video disabled so the shutter must be closed. if (shutterView != null) { shutterView.setVisibility(VISIBLE); } // Display artwork if enabled and available, else hide it. if (useArtwork) { for (int i = 0; i < selections.length; i++) { TrackSelection selection = selections.get(i); if (selection != null) { for (int j = 0; j < selection.length(); j++) { Metadata metadata = selection.getFormat(j).metadata; if (metadata != null && setArtworkFromMetadata(metadata)) { return; } } } } if (setArtworkFromBitmap(defaultArtwork)) { return; } } // Artwork disabled or unavailable. hideArtwork(); }
Example 6
Source File: SimpleExoPlayerView.java From K-Sonic with MIT License | 5 votes |
private void updateForCurrentTrackSelections() { if (player == null) { return; } TrackSelectionArray selections = player.getCurrentTrackSelections(); for (int i = 0; i < selections.length; i++) { if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) { // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in // onRenderedFirstFrame(). hideArtwork(); return; } } // Video disabled so the shutter must be closed. if (shutterView != null) { shutterView.setVisibility(VISIBLE); } // Display artwork if enabled and available, else hide it. if (useArtwork) { for (int i = 0; i < selections.length; i++) { TrackSelection selection = selections.get(i); if (selection != null) { for (int j = 0; j < selection.length(); j++) { Metadata metadata = selection.getFormat(j).metadata; if (metadata != null && setArtworkFromMetadata(metadata)) { return; } } } } if (setArtworkFromBitmap(defaultArtwork)) { return; } } // Artwork disabled or unavailable. hideArtwork(); }
Example 7
Source File: DefaultLoadControl.java From K-Sonic with MIT License | 5 votes |
@Override public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelections.get(i) != null) { targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType()); } } allocator.setTargetBufferSize(targetBufferSize); }
Example 8
Source File: ExoPlayerView.java From react-native-video with MIT License | 5 votes |
private void updateForCurrentTrackSelections() { if (player == null) { return; } TrackSelectionArray selections = player.getCurrentTrackSelections(); for (int i = 0; i < selections.length; i++) { if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) { // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in // onRenderedFirstFrame(). return; } } // Video disabled so the shutter must be closed. shutterView.setVisibility(VISIBLE); }
Example 9
Source File: DefaultLoadControl.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * Calculate target buffer size in bytes based on the selected tracks. The player will try not to * exceed this target buffer. Only used when {@code targetBufferBytes} is {@link C#LENGTH_UNSET}. * * @param renderers The renderers for which the track were selected. * @param trackSelectionArray The selected tracks. * @return The target buffer size in bytes. */ protected int calculateTargetBufferSize( Renderer[] renderers, TrackSelectionArray trackSelectionArray) { int targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelectionArray.get(i) != null) { targetBufferSize += getDefaultBufferSize(renderers[i].getTrackType()); } } return targetBufferSize; }
Example 10
Source File: DefaultLoadControl.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private static boolean hasVideo(Renderer[] renderers, TrackSelectionArray trackSelectionArray) { for (int i = 0; i < renderers.length; i++) { if (renderers[i].getTrackType() == C.TRACK_TYPE_VIDEO && trackSelectionArray.get(i) != null) { return true; } } return false; }
Example 11
Source File: DefaultLoadControl.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * Calculate target buffer size in bytes based on the selected tracks. The player will try not to * exceed this target buffer. Only used when {@code targetBufferBytes} is {@link C#LENGTH_UNSET}. * * @param renderers The renderers for which the track were selected. * @param trackSelectionArray The selected tracks. * @return The target buffer size in bytes. */ protected int calculateTargetBufferSize( Renderer[] renderers, TrackSelectionArray trackSelectionArray) { int targetBufferSize = 0; for (int i = 0; i < renderers.length; i++) { if (trackSelectionArray.get(i) != null) { targetBufferSize += getDefaultBufferSize(renderers[i].getTrackType()); } } return targetBufferSize; }
Example 12
Source File: DefaultLoadControl.java From Telegram with GNU General Public License v2.0 | 5 votes |
private static boolean hasVideo(Renderer[] renderers, TrackSelectionArray trackSelectionArray) { for (int i = 0; i < renderers.length; i++) { if (renderers[i].getTrackType() == C.TRACK_TYPE_VIDEO && trackSelectionArray.get(i) != null) { return true; } } return false; }
Example 13
Source File: CustomizePlayerView.java From bcm-android with GNU General Public License v3.0 | 4 votes |
private void updateForCurrentTrackSelections(boolean isNewPlayer) { if (player == null || player.getCurrentTrackGroups().isEmpty()) { if (!keepContentOnPlayerReset) { hideArtwork(); closeShutter(); } return; } if (isNewPlayer && !keepContentOnPlayerReset) { closeShutter(); } TrackSelectionArray selections = player.getCurrentTrackSelections(); for (int i = 0; i < selections.length; i++) { if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) { hideArtwork(); return; } } closeShutter(); if (useArtwork) { for (int i = 0; i < selections.length; i++) { TrackSelection selection = selections.get(i); if (selection != null) { for (int j = 0; j < selection.length(); j++) { Metadata metadata = selection.getFormat(j).metadata; if (metadata != null && setArtworkFromMetadata(metadata)) { return; } } } } if (setArtworkFromBitmap(defaultArtwork)) { return; } } // Artwork disabled or unavailable. hideArtwork(); }