本文整理汇总了Java中com.google.android.exoplayer.util.PlayerControl类的典型用法代码示例。如果您正苦于以下问题:Java PlayerControl类的具体用法?Java PlayerControl怎么用?Java PlayerControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerControl类属于com.google.android.exoplayer.util包,在下文中一共展示了PlayerControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preparePlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
private void preparePlayer() {
SampleSource sampleSource =
new FrameworkSampleSource(this, Uri.parse(mVideo.getContentUrl()), /* headers */ null, RENDERER_COUNT);
// Build the track renderers
videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
// Setup the player
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
// Build the player controls
mediaController.setMediaPlayer(new PlayerControl(player));
mediaController.setEnabled(true);
player.prepare(videoRenderer, audioRenderer);
}
示例2: preparePlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
private void preparePlayer() {
SampleSource sampleSource =
new FrameworkSampleSource(this, Uri.parse(mVideo.getContentUrl()), /* headers */ null, RENDERER_COUNT);
// Build the track renderers
videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
// Setup the player
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
// Build the player controls
mediaController.setMediaPlayer(new PlayerControl(player));
mediaController.setEnabled(true);
player.prepare(videoRenderer, audioRenderer);
}
示例3: DemoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public DemoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
//###AXT:: --> try to start the player without internal buffering. We do buffering in Raw Sample sources
// player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, -1, -1);
//###AXT:: <--
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<Listener>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
selectedTracks = new int[RENDERER_COUNT];
// Disable text initially.
selectedTracks[TYPE_TEXT] = DISABLED_TRACK;
}
示例4: DemoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public DemoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
// Enable text initially.
player.setSelectedTrack(TYPE_TEXT, TRACK_DEFAULT);
}
示例5: VideoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public VideoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
// Disable text initially.
player.setSelectedTrack(TYPE_TEXT, TRACK_DISABLED);
}
示例6: DemoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public DemoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
// Disable text initially.
player.setSelectedTrack(TYPE_TEXT, TRACK_DISABLED);
}
示例7: initPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
private void initPlayer() {
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT);
playerControl = new PlayerControl(player);
if (player != null) {
rendererBuilder = getHpLibRendererBuilder();
rendererBuilder.buildRenderers(this);
mainHandler.postDelayed(updatePlayer, 200);
}
}
示例8: ExoPlayerHelper
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public ExoPlayerHelper(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
// Disable text initially.
player.setSelectedTrack(TYPE_TEXT, TRACK_DISABLED);
}
示例9: MediaPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public MediaPlayer(Context context) {
this.context = context;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
selectedTracks = new int[RENDERER_COUNT];
// Disable text initially.
selectedTracks[TYPE_TEXT] = DISABLED_TRACK;
}
示例10: startBasicPlayback
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
private void startBasicPlayback() {
player = ExoPlayer.Factory.newInstance(4);
player.addListener(this);
mediaController.setMediaPlayer(new PlayerControl(player));
mediaController.setEnabled(true);
ExtractorSampleSource sampleSource = new ExtractorSampleSource(
contentUri,
new DefaultUriDataSource(this, Util.getUserAgent(this, "ExoPlayerExtWebMDemo")),
new DefaultAllocator(BUFFER_SEGMENT_SIZE), BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT,
new WebmExtractor(), new FlacExtractor(), new OggExtractor());
TrackRenderer videoRenderer =
new LibvpxVideoTrackRenderer(sampleSource, true, handler, this, 50);
if (useOpenGL) {
player.sendMessage(videoRenderer, LibvpxVideoTrackRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
vpxVideoSurfaceView);
surfaceView.setVisibility(View.GONE);
} else {
player.sendMessage(
videoRenderer, LibvpxVideoTrackRenderer.MSG_SET_SURFACE,
surfaceView.getHolder().getSurface());
vpxVideoSurfaceView.setVisibility(View.GONE);
}
TrackRenderer opusAudioTrackRenderer = new LibopusAudioTrackRenderer(sampleSource);
TrackRenderer flacAudioTrackRenderer = new LibflacAudioTrackRenderer(sampleSource);
TrackRenderer mediaCodecAudioTrackRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
MediaCodecSelector.DEFAULT);
player.prepare(videoRenderer, opusAudioTrackRenderer, flacAudioTrackRenderer,
mediaCodecAudioTrackRenderer);
player.setPlayWhenReady(true);
}
示例11: onRenderersBuilt
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public void onRenderersBuilt(TrackRenderer[] renderers) {
surfaceView.setVisibility(View.GONE);
player = ExoPlayer.Factory.newInstance(renderers.length);
player.addListener(this);
mediaController.setMediaPlayer(new PlayerControl(player));
mediaController.setEnabled(true);
player.sendMessage(renderers[0], LibvpxVideoTrackRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
vpxVideoSurfaceView);
player.prepare(renderers);
player.setPlayWhenReady(true);
}
示例12: Player
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public Player(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 2000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
// Disable text initially.
player.setSelectedTrack(TYPE_TEXT, TRACK_DISABLED);
}
示例13: VideoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public VideoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
selectedTracks = new int[RENDERER_COUNT];
// Disable text initially.
selectedTracks[TYPE_TEXT] = DISABLED_TRACK;
}
示例14: DemoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
/**
* Creates a {@link DemoPlayer} instance.
*/
public DemoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
// Disable text initially.
player.setSelectedTrack(TYPE_TEXT, TRACK_DISABLED);
}
示例15: DemoPlayer
import com.google.android.exoplayer.util.PlayerControl; //导入依赖的package包/类
public DemoPlayer(RendererBuilder rendererBuilder) {
this.rendererBuilder = rendererBuilder;
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, 1000, 5000);
player.addListener(this);
playerControl = new PlayerControl(player);
mainHandler = new Handler();
listeners = new CopyOnWriteArrayList<Listener>();
lastReportedPlaybackState = STATE_IDLE;
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
selectedTracks = new int[RENDERER_COUNT];
// Disable text initially.
selectedTracks[TYPE_TEXT] = DISABLED_TRACK;
}