com.google.android.exoplayer2.PlayerMessage Java Examples
The following examples show how to use
com.google.android.exoplayer2.PlayerMessage.
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: ExoFFmpegPlayer.java From DanDanPlayForAndroid with MIT License | 6 votes |
private void onSurfaceSizeChanged(int width, int height) { List<PlayerMessage> messages = new ArrayList<>(); Point size = new Point(width, height); for (Renderer renderer : renderers) { if (renderer.getTrackType() == C.TRACK_TYPE_VIDEO) { messages.add(createMessage(renderer).setType(Constant.MSG_SURFACE_SIZE_CHANGED).setPayload(size).send()); } } try { for (PlayerMessage message : messages){ message.blockUntilDelivered(); } } catch (InterruptedException e) { e.printStackTrace(); } }
Example #2
Source File: ExoFFmpegPlayer.java From DanDanPlayForAndroid with MIT License | 6 votes |
private void onPlayReleased() { List<PlayerMessage> messages = new ArrayList<>(); for (Renderer renderer : renderers) { messages.add(createMessage(renderer).setType(MSG_PLAY_RELEASED).send()); } try { for (PlayerMessage message : messages){ message.blockUntilDelivered(); } } catch (InterruptedException e) { e.printStackTrace(); } }
Example #3
Source File: ExoMediaPlayer.java From ExoMedia with Apache License 2.0 | 6 votes |
protected void sendMessage(int renderType, int messageType, Object message, boolean blocking) { if (renderers.isEmpty()) { return; } List<PlayerMessage> messages = new ArrayList<>(); for (Renderer renderer : renderers) { if (renderer.getTrackType() == renderType) { messages.add(player.createMessage(renderer).setType(messageType).setPayload(message)); } } if (blocking) { blockingSendMessages(messages); } else { for (PlayerMessage playerMessage : messages) { playerMessage.send(); } } }
Example #4
Source File: ExoMediaPlayer.java From ExoMedia with Apache License 2.0 | 6 votes |
/** * This was pulled from the <i>Deprecated</i> ExoPlayerImpl#blockingSendMessages method * * @param messages The messages */ protected void blockingSendMessages(List<PlayerMessage> messages) { boolean wasInterrupted = false; for (PlayerMessage message : messages) { boolean blockMessage = true; while (blockMessage) { try { message.blockUntilDelivered(); blockMessage = false; } catch (InterruptedException e) { wasInterrupted = true; } } } if (wasInterrupted) { // Restore the interrupted status. Thread.currentThread().interrupt(); } }