本文整理汇总了Java中com.google.android.exoplayer2.Renderer类的典型用法代码示例。如果您正苦于以下问题:Java Renderer类的具体用法?Java Renderer怎么用?Java Renderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Renderer类属于com.google.android.exoplayer2包,在下文中一共展示了Renderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setVideoSurfaceInternal
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
private void setVideoSurfaceInternal(Surface surface, boolean ownsSurface) {
// Note: We don't turn this method into a no-op if the surface is being replaced with itself
// so as to ensure onRenderedFirstFrame callbacks are still called in this case.
ExoPlayerMessage[] messages = new ExoPlayerMessage[videoRendererCount];
int count = 0;
for (Renderer renderer : renderers) {
if (renderer.getTrackType() == C.TRACK_TYPE_VIDEO) {
messages[count++] = new ExoPlayerMessage(renderer, C.MSG_SET_SURFACE, surface);
}
}
if (this.surface != null && this.surface != surface) {
// We're replacing a surface. Block to ensure that it's not accessed after the method returns.
player.blockingSendMessages(messages);
// If we created the previous surface, we are responsible for releasing it.
if (this.ownsSurface) {
this.surface.release();
}
} else {
player.sendMessages(messages);
}
this.surface = surface;
this.ownsSurface = ownsSurface;
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:24,代码来源:SimpleExoPlayer2.java
示例2: createRenderers
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public Renderer[] createRenderers(Handler eventHandler,
VideoRendererEventListener videoRendererEventListener,
AudioRendererEventListener audioRendererEventListener,
TextOutput textRendererOutput,
MetadataOutput metadataRendererOutput) {
ArrayList<Renderer> renderersList = new ArrayList<>();
buildVideoRenderers(context, drmSessionManager, allowedVideoJoiningTimeMs,
eventHandler, videoRendererEventListener, extensionRendererMode, renderersList);
buildAudioRenderers(context, drmSessionManager, buildAudioProcessors(),
eventHandler, audioRendererEventListener, extensionRendererMode, renderersList);
buildTextRenderers(textRendererOutput, eventHandler.getLooper(),
renderersList);
buildMetadataRenderers(metadataRendererOutput, eventHandler.getLooper(),
renderersList);
buildMiscellaneousRenderers();
return renderersList.toArray(new Renderer[renderersList.size()]);
}
开发者ID:novoda,项目名称:no-player,代码行数:19,代码来源:SimpleRenderersFactory.java
示例3: run
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void run() {
Looper.prepare();
LibvpxVideoRenderer videoRenderer = new LibvpxVideoRenderer(true, 0);
DefaultTrackSelector trackSelector = new DefaultTrackSelector();
player = ExoPlayerFactory.newInstance(new Renderer[] {videoRenderer}, trackSelector);
player.addListener(this);
ExtractorMediaSource mediaSource = new ExtractorMediaSource(
uri,
new DefaultDataSourceFactory(context, "ExoPlayerExtVp9Test"),
MatroskaExtractor.FACTORY,
null,
null);
player.sendMessages(new ExoPlayer.ExoPlayerMessage(videoRenderer,
LibvpxVideoRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
new VpxVideoSurfaceView(context)));
player.prepare(mediaSource);
player.setPlayWhenReady(true);
Looper.loop();
}
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:21,代码来源:VpxPlaybackTest.java
示例4: run
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void run() {
Looper.prepare();
LibopusAudioRenderer audioRenderer = new LibopusAudioRenderer();
DefaultTrackSelector trackSelector = new DefaultTrackSelector();
player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
player.addListener(this);
ExtractorMediaSource mediaSource = new ExtractorMediaSource(
uri,
new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"),
MatroskaExtractor.FACTORY,
null,
null);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
Looper.loop();
}
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:18,代码来源:OpusPlaybackTest.java
示例5: run
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void run() {
Looper.prepare();
LibflacAudioRenderer audioRenderer = new LibflacAudioRenderer();
DefaultTrackSelector trackSelector = new DefaultTrackSelector();
player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
player.addListener(this);
ExtractorMediaSource mediaSource = new ExtractorMediaSource(
uri,
new DefaultDataSourceFactory(context, "ExoPlayerExtFlacTest"),
MatroskaExtractor.FACTORY,
null,
null);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
Looper.loop();
}
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:18,代码来源:FlacPlaybackTest.java
示例6: buildAudioRenderers
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@NonNull
protected List<Renderer> buildAudioRenderers() {
List<Renderer> renderers = new ArrayList<>();
renderers.add(new MediaCodecAudioRenderer(MediaCodecSelector.DEFAULT, drmSessionManager, true, handler, audioRendererEventListener, AudioCapabilities.getCapabilities(context)));
// Adds any registered classes
List<String> classNames = ExoMedia.Data.registeredRendererClasses.get(ExoMedia.RendererType.AUDIO);
if (classNames != null) {
for (String className: classNames) {
try {
Class<?> clazz = Class.forName(className);
Constructor<?> constructor = clazz.getConstructor(Handler.class, AudioRendererEventListener.class);
Renderer renderer = (Renderer) constructor.newInstance(handler, audioRendererEventListener);
renderers.add(renderer);
} catch (Exception e) {
// Purposefully left blank
}
}
}
return renderers;
}
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:24,代码来源:RendererProvider.java
示例7: buildVideoRenderers
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@NonNull
protected List<Renderer> buildVideoRenderers() {
List<Renderer> renderers = new ArrayList<>();
renderers.add(new MediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT, videoJoiningTimeMs, drmSessionManager, false, handler, videoRendererEventListener, droppedFrameNotificationAmount));
// Adds any registered classes
List<String> classNames = ExoMedia.Data.registeredRendererClasses.get(ExoMedia.RendererType.VIDEO);
if (classNames != null) {
for (String className: classNames) {
try {
Class<?> clazz = Class.forName(className);
Constructor<?> constructor = clazz.getConstructor(boolean.class, long.class, Handler.class, VideoRendererEventListener.class, int.class);
Renderer renderer = (Renderer) constructor.newInstance(true, videoJoiningTimeMs, handler, videoRendererEventListener, droppedFrameNotificationAmount);
renderers.add(renderer);
} catch (Exception e) {
// Purposefully left blank
}
}
}
return renderers;
}
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:24,代码来源:RendererProvider.java
示例8: ExoMediaPlayer
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
public ExoMediaPlayer(@NonNull Context context) {
this.context = context;
bufferRepeater.setRepeaterDelay(BUFFER_REPEAT_DELAY);
bufferRepeater.setRepeatListener(new BufferRepeatListener());
mainHandler = new Handler();
ComponentListener componentListener = new ComponentListener();
RendererProvider rendererProvider = new RendererProvider(context, mainHandler, componentListener, componentListener, componentListener, componentListener);
rendererProvider.setDrmSessionManager(generateDrmSessionManager());
renderers = rendererProvider.generate();
adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);
LoadControl loadControl = ExoMedia.Data.loadControl != null ? ExoMedia.Data.loadControl : new DefaultLoadControl();
player = ExoPlayerFactory.newInstance(renderers.toArray(new Renderer[renderers.size()]), trackSelector, loadControl);
player.addListener(this);
}
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:22,代码来源:ExoMediaPlayer.java
示例9: sendMessage
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
protected void sendMessage(int renderType, int messageType, Object message, boolean blocking) {
if (renderers.isEmpty()) {
return;
}
List<ExoPlayer.ExoPlayerMessage> messages = new ArrayList<>();
for (Renderer renderer : renderers) {
if (renderer.getTrackType() == renderType) {
messages.add(new ExoPlayer.ExoPlayerMessage(renderer, messageType, message));
}
}
if (blocking) {
player.blockingSendMessages(messages.toArray(new ExoPlayer.ExoPlayerMessage[messages.size()]));
} else {
player.sendMessages(messages.toArray(new ExoPlayer.ExoPlayerMessage[messages.size()]));
}
}
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:19,代码来源:ExoMediaPlayer.java
示例10: run
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void run() {
Looper.prepare();
LibvpxVideoRenderer videoRenderer = new LibvpxVideoRenderer(true, 0);
DefaultTrackSelector trackSelector = new DefaultTrackSelector();
player = ExoPlayerFactory.newInstance(new Renderer[] {videoRenderer}, trackSelector);
player.addListener(this);
MediaSource mediaSource =
new ExtractorMediaSource.Factory(
new DefaultDataSourceFactory(context, "ExoPlayerExtVp9Test"))
.setExtractorsFactory(MatroskaExtractor.FACTORY)
.createMediaSource(uri);
player.sendMessages(new ExoPlayer.ExoPlayerMessage(videoRenderer,
LibvpxVideoRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
new VpxVideoSurfaceView(context)));
player.prepare(mediaSource);
player.setPlayWhenReady(true);
Looper.loop();
}
开发者ID:y20k,项目名称:transistor,代码行数:20,代码来源:VpxPlaybackTest.java
示例11: run
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void run() {
Looper.prepare();
LibopusAudioRenderer audioRenderer = new LibopusAudioRenderer();
DefaultTrackSelector trackSelector = new DefaultTrackSelector();
player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
player.addListener(this);
MediaSource mediaSource =
new ExtractorMediaSource.Factory(
new DefaultDataSourceFactory(context, "ExoPlayerExtOpusTest"))
.setExtractorsFactory(MatroskaExtractor.FACTORY)
.createMediaSource(uri);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
Looper.loop();
}
开发者ID:y20k,项目名称:transistor,代码行数:17,代码来源:OpusPlaybackTest.java
示例12: run
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void run() {
Looper.prepare();
LibflacAudioRenderer audioRenderer = new LibflacAudioRenderer();
DefaultTrackSelector trackSelector = new DefaultTrackSelector();
player = ExoPlayerFactory.newInstance(new Renderer[] {audioRenderer}, trackSelector);
player.addListener(this);
MediaSource mediaSource =
new ExtractorMediaSource.Factory(
new DefaultDataSourceFactory(context, "ExoPlayerExtFlacTest"))
.setExtractorsFactory(MatroskaExtractor.FACTORY)
.createMediaSource(uri);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
Looper.loop();
}
开发者ID:y20k,项目名称:transistor,代码行数:17,代码来源:FlacPlaybackTest.java
示例13: FakeExoPlayer
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
public FakeExoPlayer(Renderer[] renderers, TrackSelector trackSelector,
LoadControl loadControl) {
this.renderers = renderers;
this.trackSelector = trackSelector;
this.loadControl = loadControl;
this.eventListeners = new CopyOnWriteArraySet<>();
Looper eventListenerLooper = Looper.myLooper();
this.eventListenerHandler = new Handler(eventListenerLooper != null ? eventListenerLooper
: Looper.getMainLooper());
this.playbackThread = new HandlerThread("FakeExoPlayer Thread");
playbackThread.start();
this.playbackHandler = new Handler(playbackThread.getLooper());
this.isStartingUp = true;
this.isLoading = false;
this.playbackState = Player.STATE_IDLE;
this.durationUs = C.TIME_UNSET;
}
开发者ID:y20k,项目名称:transistor,代码行数:18,代码来源:FakeSimpleExoPlayer.java
示例14: onTracksSelected
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@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);
}
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:11,代码来源:BufferingLoadControl.java
示例15: buildVideoRenderers
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
protected void buildVideoRenderers(Context context, Handler mainHandler,
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
@ExtensionRendererMode int extensionRendererMode, VideoRendererEventListener eventListener,
long allowedVideoJoiningTimeMs, ArrayList<Renderer> out) {
out.add(new DebugMediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT,
allowedVideoJoiningTimeMs, mainHandler, drmSessionManager, eventListener,
MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY));
}
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:10,代码来源:DebugSimpleExoPlayer.java
示例16: onTracksSelected
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
@Override
public void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups,
TrackSelectionArray trackSelections) {
int targetBufferSize = 0;
for (int i = 0; i < renderers.length; i++) {
if (trackSelections.get(i) != null) {
targetBufferSize += Util.getDefaultBufferSize(renderers[i].getTrackType());
}
}
allocator.setTargetBufferSize(targetBufferSize);
}
开发者ID:hongcwamazing,项目名称:PreviewSeekBar-master,代码行数:12,代码来源:PreviewLoadControl.java
示例17: SimpleExoPlayer2
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
public SimpleExoPlayer2(RenderersFactory renderersFactory, TrackSelector trackSelector,
LoadControl loadControl) {
componentListener = new ComponentListener();
videoListeners = new CopyOnWriteArraySet<>();
textOutputs = new CopyOnWriteArraySet<>();
metadataOutputs = new CopyOnWriteArraySet<>();
Looper eventLooper = Looper.myLooper() != null ? Looper.myLooper() : Looper.getMainLooper();
Handler eventHandler = new Handler(eventLooper);
renderers = renderersFactory.createRenderers(eventHandler, componentListener, componentListener,
componentListener, componentListener);
// Obtain counts of video and audio renderers.
int videoRendererCount = 0;
int audioRendererCount = 0;
for (Renderer renderer : renderers) {
switch (renderer.getTrackType()) {
case C.TRACK_TYPE_VIDEO:
videoRendererCount++;
break;
case C.TRACK_TYPE_AUDIO:
audioRendererCount++;
break;
}
}
this.videoRendererCount = videoRendererCount;
this.audioRendererCount = audioRendererCount;
// Set initial values.
audioVolume = 1;
audioSessionId = C.AUDIO_SESSION_ID_UNSET;
audioAttributes = AudioAttributes.DEFAULT;
videoScalingMode = C.VIDEO_SCALING_MODE_DEFAULT;
// Build the player and associated objects.
player = createExoPlayerImpl(renderers, trackSelector, loadControl);
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:37,代码来源:SimpleExoPlayer2.java
示例18: setVideoScalingMode
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
public void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
this.videoScalingMode = videoScalingMode;
ExoPlayerMessage[] messages = new ExoPlayerMessage[videoRendererCount];
int count = 0;
for (Renderer renderer : renderers) {
if (renderer.getTrackType() == C.TRACK_TYPE_VIDEO) {
messages[count++] = new ExoPlayerMessage(renderer, C.MSG_SET_SCALING_MODE,
videoScalingMode);
}
}
player.sendMessages(messages);
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:13,代码来源:SimpleExoPlayer2.java
示例19: setAudioAttributes
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
public void setAudioAttributes(AudioAttributes audioAttributes) {
this.audioAttributes = audioAttributes;
ExoPlayerMessage[] messages = new ExoPlayerMessage[audioRendererCount];
int count = 0;
for (Renderer renderer : renderers) {
if (renderer.getTrackType() == C.TRACK_TYPE_AUDIO) {
messages[count++] = new ExoPlayerMessage(renderer, C.MSG_SET_AUDIO_ATTRIBUTES,
audioAttributes);
}
}
player.sendMessages(messages);
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:13,代码来源:SimpleExoPlayer2.java
示例20: setVolume
import com.google.android.exoplayer2.Renderer; //导入依赖的package包/类
/**
* Sets the audio volume, with 0 being silence and 1 being unity gain.
*
* @param audioVolume The audio volume.
*/
public void setVolume(float audioVolume) {
this.audioVolume = audioVolume;
ExoPlayerMessage[] messages = new ExoPlayerMessage[audioRendererCount];
int count = 0;
for (Renderer renderer : renderers) {
if (renderer.getTrackType() == C.TRACK_TYPE_AUDIO) {
messages[count++] = new ExoPlayerMessage(renderer, C.MSG_SET_VOLUME, audioVolume);
}
}
player.sendMessages(messages);
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:17,代码来源:SimpleExoPlayer2.java
注:本文中的com.google.android.exoplayer2.Renderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论