android.widget.MediaController.setMediaPlayer()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中android.widget.MediaController.setMediaPlayer()方法的一些代码示例,展示了MediaController.setMediaPlayer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaController.setMediaPlayer()方法的具体详情如下:
包路径:android.widget.MediaController
类名称:MediaController
方法名:setMediaPlayer

MediaController.setMediaPlayer介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

VideoView myVideoView = (VideoView) findViewById(R.id.my_video_view);
MediaController mc = new MyMediaController(myVideoView.getContext());
mc.setMediaPlayer(myVideoView);
myVideoView.setMediaController(mc);

代码示例来源:origin: commonsguy/cw-omnibus

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.player);
 video=(VideoView)findViewById(R.id.player);
 ctlr=new MediaController(this);
 ctlr.setMediaPlayer(video);
 video.setMediaController(ctlr);
 fab=findViewById(R.id.pip);
 fab.setOnClickListener(this);
 current=getIntent();
 play();
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onReady(Bundle state) {
  getWindow().setFormat(PixelFormat.TRANSLUCENT);
  setContentView(R.layout.main);
 
  File clip=new File(Environment.getExternalStorageDirectory(),
            "test.mp4");
  
  if (clip.exists()) {
   video=(VideoView)findViewById(R.id.video);
   video.setVideoPath(clip.getAbsolutePath());
   
   ctlr=new MediaController(this);
   ctlr.setMediaPlayer(video);
   video.setMediaController(ctlr);
   video.requestFocus();
   video.start();
  }
 }
}

代码示例来源:origin: stackoverflow.com

MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
videoView.setMediaController(mc);
String _path = "/mnt/sdcard/Movies/video5.mp4";

代码示例来源:origin: florent37/CameraFragment

mediaController = new MediaController(PreviewActivity.this);
mediaController.setAnchorView(surfaceView);
mediaController.setMediaPlayer(new MediaController.MediaPlayerControl() {
  @Override
  public void start() {

代码示例来源:origin: stackoverflow.com

startVideoPlayback();
mcontroller.setMediaPlayer(this);
mcontroller.setAnchorView(findViewById(R.id.mediaplayer_surfaceview_container));
handler.post(new Runnable() {

代码示例来源:origin: stackoverflow.com

final VideoView video = (VideoView) findViewById(R.id.videoplayer);
     final MediaController controller = new MediaController(this);
     video.setVideoURI(Uri.parse(getIntent().getStringExtra("url")));
     video.setMediaController(controller);
     controller.setMediaPlayer(video);
     video.setOnPreparedListener(new OnPreparedListener() {
         public void onPrepared(MediaPlayer mp) {
           int duration = video.getDuration();
           video.requestFocus();
           video.start();
           controller.show();
         }
       });

代码示例来源:origin: stackoverflow.com

mediaController.setMediaPlayer(this);
mediaController.setAnchorView(findViewById(R.id.main_audio_view));

代码示例来源:origin: stackoverflow.com

void playvideo(String url) 
{
  String  link=url;
  Log.e("url",link);
  view1 = (VideoView) findViewById(R.id.myVideoView); 
  getWindow().setFormat(PixelFormat.TRANSLUCENT);
  MediaController mc = new MediaController(this); 
  mc.setMediaPlayer(view1); 
  view1.setMediaController(mc); 
  view1.setVideoURI(Uri.parse(link)); 
  view1.requestFocus(); 
  view1.start();
}

代码示例来源:origin: stackoverflow.com

ctlr.setMediaPlayer(videoView);
videoView.setMediaController(ctlr);
videoView.requestFocus();

代码示例来源:origin: stackoverflow.com

String LINK = "type_here_the_link";
VideoView mVideoView  = (VideoView) findViewById(R.id.videoview);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(LINK);
mVideoView.setMediaController(mc);
mVideoView.setVideoURI(video);
mVideoView.start();

代码示例来源:origin: stackoverflow.com

MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
videoView.setMediaController(mc);
String _path = "/mnt/sdcard/Movies/video5.mp4";

代码示例来源:origin: pili-engineering/PLDroidShortVideo

mMediaController.setMediaPlayer(this);
mMediaController.setAnchorView(mSurfaceView);

代码示例来源:origin: fire3/sailorcast

@Override
public void setMediaPlayer(MediaPlayerControl playerControl) {
  super.setMediaPlayer(playerControl);
  this.playerControl = playerControl;
}

代码示例来源:origin: weexteam/weex-hackernews

private synchronized void createVideoView() {
 if(mVideoView != null){
  return;
 }
 Context context = getContext();
 WXVideoView video = new WXVideoView(context);
 FrameLayout.LayoutParams videoLayoutParams =
   new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
     FrameLayout.LayoutParams.MATCH_PARENT);
 videoLayoutParams.gravity = Gravity.CENTER;
 video.setLayoutParams(videoLayoutParams);
 addView(video, 0);//first child
 video.setOnErrorListener(mOnErrorListener);
 video.setOnPreparedListener(mOnPreparedListener);
 video.setOnCompletionListener(mOnCompletionListener);
 video.setOnVideoPauseListener(mVideoPlayListener);
 MediaController controller = new MediaController(context);
 controller.setAnchorView(this);
 video.setMediaController(controller);
 controller.setMediaPlayer(video);
 mMediaController = controller;
 mVideoView = video;
 if(mUri != null) {
  setVideoURI(mUri);
 }
}

代码示例来源:origin: stackoverflow.com

MediaController mc = new MediaController(this);
mc.setAnchorView(vidYout);
mc.setMediaPlayer(vidYout);
Log.v("TAG","URL: "+YoutubeVO.url_video);
Uri video = Uri.parse("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8");
// Uri video = Uri.parse(YoutubeVO.url_video);
vidYout.setMediaController(mc);
vidYout.setVideoURI(video);
vidYout.requestFocus();
vidYout.start();

代码示例来源:origin: stackoverflow.com

MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(path); // Here path is your video file path place in internal storage
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();

代码示例来源:origin: stackoverflow.com

// this can be path on file system
String path="/adf.mp4"  ; 
 public void playVideo() { 
   MediaController mediaController = new MediaController(this);
   mediaController.setMediaPlayer(videoView);
   videoView.setVideoPath(path);   
   videoView.setMediaController(mediaController);
   videoView.requestFocus();
   videoView.start();
   mediaController.show();

代码示例来源:origin: mrgames13/SplashScreen

private void attachMediaController() {
  if (mMediaPlayer != null && mMediaController != null) {
    mMediaController.setMediaPlayer(this);
    View anchorView = this.getParent() instanceof View ? (View)this.getParent() : this;
    mMediaController.setAnchorView(anchorView);
    mMediaController.setEnabled(isInPlaybackState());
  }
}

代码示例来源:origin: stackoverflow.com

String LINK = "http://www.boisestatefootball.com/sites/default/files/videos/original/01%20-%20coach%20pete%20bio_4.mp4";
setContentView(R.layout.video);
VideoView videoView =(VideoView)findViewById(R.id.webView);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(LINK);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.start();

相关文章