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

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

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

MediaController.<init>介绍

暂无

代码示例

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

VideoView videoView = (VideoView)findViewById(R.id.your_video_view);
 MediaController mc = new MediaController(this);
 videoView.setMediaController(mc);
 String str = "the url to your video";
 Uri uri = Uri.parse(str);
 videoView.setVideoURI(uri);
 videoView.requestFocus();
 videoView.start();

代码示例来源: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: florent37/CameraFragment

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

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

getWindow().setFormat(PixelFormat.TRANSLUCENT);
VideoView videoHolder = new VideoView(this);
//if you want the controls to appear
videoHolder.setMediaController(new MediaController(this));
Uri video = Uri.parse("android.resource://" + getPackageName() + "/" 
+ R.raw.your_raw_file); //do not add any extension
//if your file is named sherif.mp4 and placed in /raw
//use R.raw.sherif
videoHolder.setVideoURI(video);
setContentView(videoHolder);
videoHolder.start();

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

mMediaPlayer.setOnVideoSizeChangedListener(this);
  mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  mcontroller = new MediaController(this);
} catch (Exception e) {
  e.printStackTrace();
mcontroller.setAnchorView(findViewById(R.id.mediaplayer_surfaceview_container));
handler.post(new Runnable() {

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

VideoView videoHolder = new VideoView(contex);
 MediaController controller=new MediaController(this);
 videoHolder.setMediaController(controller);

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

public class VideoEkrani extends Activity {

  VideoView ekran;
  String kaynakYolu = "http://commonsware.com/misc/test2.3gp";
  ProgressDialog progDailog;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sayfa_video_goruntule);

    ekran = (VideoView) findViewById(R.id.videoViewESPU);
    ekran.setMediaController(new MediaController(this));
    ekran.setVideoURI(Uri.parse(kaynakYolu));
    ekran.requestFocus();
    ekran.start();

    progDailog = ProgressDialog.show(this, "Please wait ...", "Retrieving data ...", true);

    ekran.setOnPreparedListener(new OnPreparedListener() {

      public void onPrepared(MediaPlayer mp) {
        // TODO Auto-generated method stub
        progDailog.dismiss();
      }
    });
  }
}

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

mediaPlayer.setOnPreparedListener(this);
mediaController = new MediaController(this);
Log.d(TAG, "onPrepared");
mediaController.setMediaPlayer(this);
mediaController.setAnchorView(findViewById(R.id.main_audio_view));

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

String httpLiveUrl = "http://aj.lsops.net/live/aljazeer_en_high.sdp/playlist.m3u8";   
videoView = (VideoView) findViewById(R.id.VideoView);
videoView.setVideoURI(Uri.parse(httpLiveUrl));
MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.start();

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

mMediaController = new MediaController(this);
mMediaController.setMediaPlayer(this);
mMediaController.setAnchorView(mSurfaceView);

代码示例来源:origin: daniulive/SmarterStreaming

@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recorder_playback);

    Intent intent = getIntent();
    recorderFilePath = intent.getStringExtra("RecorderFilePath");

    filePathTextView = (TextView) findViewById(R.id.textViewRecoderPlaybackFilePath);
    if (recorderFilePath != null) {
      filePathTextView.setText(recorderFilePath);
    } else {
      Log.i(Tag, "recorderFilePath is null");
    }

    playVideoView = (VideoView) findViewById(R.id.VideoViewRecoderPlayback);

    if (recorderFilePath != null && !recorderFilePath.isEmpty()) {
      playVideoView.setVideoPath(recorderFilePath);
      playVideoView.setMediaController(new MediaController(this));
      playVideoView.requestFocus();
      playVideoView.start();

    }
  }
}

代码示例来源: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: daniulive/SmarterStreaming

@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recorder_playback);

    Intent intent = getIntent();
    recorderFilePath = intent.getStringExtra("RecorderFilePath");

    filePathTextView = (TextView) findViewById(R.id.textViewRecoderPlaybackFilePath);
    if (recorderFilePath != null) {
      filePathTextView.setText(recorderFilePath);
    } else {
      Log.i(Tag, "recorderFilePath is null");
    }

    playVideoView = (VideoView) findViewById(R.id.VideoViewRecoderPlayback);

    if (recorderFilePath != null && !recorderFilePath.isEmpty()) {
      playVideoView.setVideoPath(recorderFilePath);
      playVideoView.setMediaController(new MediaController(this));
      playVideoView.requestFocus();
      playVideoView.start();

    }
  }
}

代码示例来源:origin: daniulive/SmarterStreaming

playVideoView.setMediaController(new MediaController(this));
playVideoView.requestFocus();  
playVideoView.start();

代码示例来源:origin: daniulive/SmarterStreaming

playVideoView.setMediaController(new MediaController(this));
playVideoView.requestFocus();  
playVideoView.start();

代码示例来源: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

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 mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
videoView.setMediaController(mc);
String _path = "/mnt/sdcard/Movies/video5.mp4";
videoView.setOnPreparedListener(PreparedListener);
videoView.requestFocus();

代码示例来源:origin: wangdan/AisenWeiBo

private void initPlayer(Uri uri) {
  videoUri = uri;
  mediaController = new MediaController(this);
  mediaController.setAnchorView(mVideoPlayer);
  mVideoPlayer.setMediaController(mediaController);
  mVideoPlayer.requestFocus();
  mVideoPlayer.setVideoURI(uri);

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

Uri uri = Uri.parse(URL); //Declare your url here.

VideoView mVideoView  = (VideoView)findViewById(R.id.videoview)
mVideoView.setMediaController(new MediaController(this));       
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start();

相关文章