本文整理汇总了Java中android.widget.MediaController.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java MediaController.setEnabled方法的具体用法?Java MediaController.setEnabled怎么用?Java MediaController.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.MediaController
的用法示例。
在下文中一共展示了MediaController.setEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.MediaController; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_videoview);
Utils.setActionBarSubtitleEllipsizeMiddle(this);
mVideoView = (VideoView) findViewById(R.id.vv);
mProgress = (ProgressBar) findViewById(R.id.progress);
mMediaPlayerControl = mVideoView; //new MediaPlayerDummyControl();
mMediaController = new MediaController(this);
mMediaController.setAnchorView(findViewById(R.id.container));
mMediaController.setMediaPlayer(mMediaPlayerControl);
mMediaController.setEnabled(false);
mProgress.setVisibility(View.VISIBLE);
// Init video playback state (will eventually be overwritten by saved instance state)
mVideoUri = getIntent().getData();
mVideoPosition = 0;
mVideoPlaybackSpeed = 1;
mVideoPlaying = false;
}
示例2: initMediaController
import android.widget.MediaController; //导入方法依赖的package包/类
/**
* Creates a media controller and attaches it to the activity.
* This method is for activities that contain a video player.
* @param mediaPlayerControl the control interface, e.g. a video view
*/
public void initMediaController(MediaController.MediaPlayerControl mediaPlayerControl) {
mMediaController = new MediaController(this);
mMediaController.setAnchorView(findViewById(R.id.container));
mMediaController.setMediaPlayer(mediaPlayerControl);
mMediaController.setEnabled(false);
}
示例3: onCreate
import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_play);
// Get a reference to the VideoView
mVideoView = (VideoView) findViewById(R.id.videoViewer);
// Add a Media controller to allow forward/reverse/pause/resume
final MediaController mMediaController = new MediaController(
VideoPlayActivity.this, true);
mMediaController.setEnabled(false);
mVideoView.setMediaController(mMediaController);
mVideoView
.setVideoURI(Uri
.parse("android.resource://qa.edu.qu.cse.cmps312.multimedia/raw/theeb"));
// Add an OnPreparedListener to enable the MediaController once the video is ready
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mMediaController.setEnabled(true);
}
});
}
示例4: onCreate
import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
View root = findViewById(R.id.root);
mediaController = new MediaController(this);
//overscan safe on 1980 * 1080 TV
mediaController.setPadding(48, 27, 48, 27);
mediaController.setAnchorView(root);
shutterView = findViewById(R.id.shutter);
surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
surfaceView.getHolder().addCallback(this);
SampleSource sampleSource =
new FrameworkSampleSource(this, Uri.parse(url), /* 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);
}
示例5: setDefaultControlsEnabled
import android.widget.MediaController; //导入方法依赖的package包/类
public void setDefaultControlsEnabled(boolean enabled) {
if (enabled) {
mediaController = new MediaController(getContext());
mediaController.setAnchorView(videoFrame);
mediaController.setMediaPlayer(okPlayer.getPlayerControl());
mediaController.setEnabled(true);
}
CustomTouchListener listener = new CustomTouchListener(getContext());
setOnTouchListener(enabled ? listener : null);
}
示例6: setupMediaController
import android.widget.MediaController; //导入方法依赖的package包/类
protected void setupMediaController() {
mMediaController = new MediaController( this );
mMediaController.setEnabled(true);
mMediaController.show();
mMediaController.setMediaPlayer( mVideoView );
}
示例7: createController
import android.widget.MediaController; //导入方法依赖的package包/类
protected void createController() {
controller = new MediaController( getActivity() );
controller.setAnchorView( getUnwrappedView() );
controller.setMediaPlayer( playerWrapper );
controller.setEnabled( true );
}
示例8: StartPlayBackground
import android.widget.MediaController; //导入方法依赖的package包/类
public void StartPlayBackground(String path) throws IOException {
Progress(true);
if (mVideoCastManager.isConnected()) {
//casting
String[] tit_ep;
tit_ep = title.split("[|]");
MediaMetadata mMediaMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MUSIC_TRACK);
mMediaMetadata.putString(MediaMetadata.KEY_TITLE, live ? title : tit_ep[0]);
mMediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, live ? "streaming" : tit_ep[1]);
mMediaMetadata.putString(MediaMetadata.KEY_STUDIO, "Jupiter Broadcasting");
mMediaMetadata.addImage(new WebImage(Uri.parse(null == pic ? "http://jb4.cdn.scaleengine.net/wp-content/themes/jb2014/images/logo.png" : pic)));
//the second only for the controller page
mMediaMetadata.addImage(new WebImage(Uri.parse(null == pic ? "http://jb4.cdn.scaleengine.net/wp-content/themes/jb2014/images/logo.png" : pic)));
MediaInfo mSelectedMedia = new MediaInfo.Builder(path)
.setContentType("audio/mp3")
.setStreamType(live ? MediaInfo.STREAM_TYPE_LIVE : MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(mMediaMetadata)
.build();
Progress(false);
mVideoCastManager.startCastControllerActivity(this, mSelectedMedia, 0, true);
} else {
//local playback
play.setEnabled(false);
start = true;
mediaController = new MediaController(this);
mp = new MediaPlayer();
mp.setDataSource(path);
mp.prepareAsync();
mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer player) {
mp.start();
Toast.makeText(getBaseContext(), "Started", Toast.LENGTH_LONG).show();
Progress(false);
iView.setVisibility(View.GONE);
}
});
mediaController.setMediaPlayer(this);
mediaController.setAnchorView(findViewById(R.id.jbplayer));
mediaController.setEnabled(true);
mediaController.show();
}
}