本文整理汇总了Java中com.google.android.exoplayer2.video.MediaCodecVideoRenderer类的典型用法代码示例。如果您正苦于以下问题:Java MediaCodecVideoRenderer类的具体用法?Java MediaCodecVideoRenderer怎么用?Java MediaCodecVideoRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaCodecVideoRenderer类属于com.google.android.exoplayer2.video包,在下文中一共展示了MediaCodecVideoRenderer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildRenderers
import com.google.android.exoplayer2.video.MediaCodecVideoRenderer; //导入依赖的package包/类
private void buildRenderers(Context context,
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager, ArrayList<Renderer> renderersList,
long allowedVideoJoiningTimeMs) {
MediaCodecVideoRenderer videoRenderer = new MediaCodecVideoRenderer(context,
MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
allowedVideoJoiningTimeMs, drmSessionManager, false, mainHandler, componentListener,
MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY);
renderersList.add(videoRenderer);
Renderer audioRenderer = new MediaCodecAudioRenderer(MediaCodecSelector.DEFAULT,
drmSessionManager, true, mainHandler, componentListener,
AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
renderersList.add(audioRenderer);
Renderer textRenderer = new TextRenderer(componentListener, mainHandler.getLooper());
renderersList.add(textRenderer);
MetadataRenderer<List<Id3Frame>> id3Renderer = new MetadataRenderer<>(componentListener,
mainHandler.getLooper(), new Id3Decoder());
renderersList.add(id3Renderer);
}
示例2: buildVideoRenderers
import com.google.android.exoplayer2.video.MediaCodecVideoRenderer; //导入依赖的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;
}