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

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

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

MediaController.setAnchorView介绍

暂无

代码示例

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

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

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

VideoView videoview;
MediaController mediacontroller;
try {
      mediacontroller = new MediaController(VideoPlayActivity.this);
      mediacontroller.setAnchorView(videoview);
      Uri video = Uri.parse(VideoURL);
      videoview.setMediaController(mediacontroller);
      videoview.setVideoURI(video);

    } catch (Exception e) {
      Log.e("Error", e.getMessage());
      e.printStackTrace();
    }

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

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

代码示例来源: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 videoView = (VideoView) view.findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(getActivity());
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(VIDEO_URI);
videoView.start();

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

VideoView videoView = (VideoView) findViewById(R.id.videoView);
//Use a media controller so that you can scroll the video contents
//and also to pause, start the video.
MediaController mediaController = new MediaController(this); 
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(Uri.parse(videoUrl));
videoView.start();

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

public class VideoPlayerController extends Activity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.video);

    VideoView videoView = (VideoView) findViewById(R.id.VideoView);
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
// Set video link (mp4 format )
    Uri video = Uri.parse("mp4 video link");
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(video);
    videoView.start();

  }
}

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

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

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

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;

public class VideoplayerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  VideoView videoView =(VideoView)findViewById(R.id.videoView);
  MediaController mediaController= new MediaController(this);
  mediaController.setAnchorView(videoView);        
  Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.one);        
  videoView.setMediaController(mediaController);
  videoView.setVideoURI(uri);        
  videoView.requestFocus();

  videoView.start();

  }
  }

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

videoView = (VideoView) inflater.inflate(R.layout.your_video_view, null);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoPath(FilePathHere);
videoFrame.addView(videoView);
videoView.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: stackoverflow.com

// Video path.
path = Environment.getExternalStorageDirectory().getPath()+"/DCIM/steprock.mp4";
videoView = (VideoView) findViewById(R.id.video_view);
final MediaController mediaController = new MediaController(this);

mediaController.setAnchorView(videoView);

Uri uri = Uri.parse(path);

videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();

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

VideoView videoView = (VideoView) findViewById(R.id.videoView);
MediaController myMediaController = new MediaController(this);

  myMediaController.setAnchorView(videoView);
  videoView.setMediaController(myMediaController);
  String uriPath = "android.resource://"+getPackageName()+"/raw/"+ "demo_video";
  Uri UrlPath=Uri.parse(uriPath);
videoView.setVideoURI(UrlPath);

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

MediaController mediaController = new MediaController(this); 
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(Uri.parse(path));
videoView.start();

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

VideoView videoView = (VideoView) findViewById(R.id.videoView);

final String MEDIA_PATH = new String(Environment.getExternalStorageDirectory()+"/sdcard/robot.avi");

MediaController mediaController = new MediaController(this);

mediaController.setAnchorView(videoView);

videoView.setVideoPath(MEDIA_PATH);

videoView.setMediaController(mediaController);

videoView.start();

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

videoView = (VideoView) findViewById(R.id.video_view);
waitSign = (ProgressBar) findViewById(R.id.progress_bar);
waitSign.setVisibility(View.VISIBLE);
MediaController contorls = new MediaController(this);
contorls.setAnchorView(videoView);
videoView.setMediaController(contorls);
String url = "http://www.somedomain.com/samplevideo.mp4";
videoView.setVideoURI(Uri.parse(url));
videoView.start();

相关文章