当前位置: 首页>>代码示例>>Java>>正文


Java MediaController.setAnchorView方法代码示例

本文整理汇总了Java中android.widget.MediaController.setAnchorView方法的典型用法代码示例。如果您正苦于以下问题:Java MediaController.setAnchorView方法的具体用法?Java MediaController.setAnchorView怎么用?Java MediaController.setAnchorView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.MediaController的用法示例。


在下文中一共展示了MediaController.setAnchorView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Find the video view by id so we can use it.
    VideoView myVideo = (VideoView) findViewById(R.id.videoView);

    // To set the path to the video. Sample.mp4 is in the "raw" folder.
    // You can use http://online.path.to.your.video also.
    myVideo.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.sample);

    // To create the media controller (play, pause, etc.)
    MediaController myController = new MediaController(this);

    // To link the media controller to the video view.
    myController.setAnchorView(myVideo);

    // To link the video view to the media controller.
    myVideo.setMediaController(myController);

    // To autoplay on opening.
    myVideo.start();

}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:26,代码来源:MainActivity.java

示例2: onPrepared

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
    public void onPrepared(MediaPlayer mp) {
        if(mHasVideo) {
            mediaPlayer.start();
            mediaPlayer.setVolume(0,0);
            setVideoSize();
            vidSurface.bringToFront();
            vidSurface.requestFocus();
            MediaController mController = new MediaController(context);
            mController.setMediaPlayer(this);
            mController.setAnchorView(vidSurface);

//        mController.show(0);
            vidSurface.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    return true;
                }
            });
        }
    }
 
开发者ID:pawelpaszki,项目名称:youtube_background_android,代码行数:22,代码来源:DownloadedFragment.java

示例3: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);

    // Load the appropriate URL in the VideoView.
    final String youtubeId = getIntent().getStringExtra(Keys.YOUTUBE_ID);
    final String videoUrl = UrlBuilder.forYoutubeId(youtubeId);
    final VideoView videoView = (VideoView) findViewById(R.id.video_view);
    videoView.setVideoPath(videoUrl);
    videoView.start();

    // Add a MediaController, which gives us play/pause, etc.
    final MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);
}
 
开发者ID:crm416,项目名称:android-lite,代码行数:18,代码来源:VideoActivity.java

示例4: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferencesState.getInstance().loadsLanguageInActivity();
    setContentView(R.layout.video_activity);

    //Displays a video file.
    MediaController mediaController = new MediaController(VideoActivity.this);
    mVideoView = (VideoView)findViewById(R.id.videoview);
    String videoPathParam = getIntent().getStringExtra(VIDEO_PATH_PARAM);
    mVideoView.setVideoPath(videoPathParam);
    mVideoView.setMediaController(mediaController);
    mediaController.setAnchorView(mVideoView);

    mVideoView.requestFocus();
    if (savedInstanceState != null) {
        mVideoView.seekTo(savedInstanceState.getInt("video",0));
    }
    mVideoView.start();
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:21,代码来源:VideoActivity.java

示例5: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_side_by_side);
    //Utils.setActionBarSubtitleEllipsizeMiddle(this);

    mAndroidVideoView = (android.widget.VideoView) findViewById(R.id.androidvv);
    mItecVideoView = (VideoView) findViewById(R.id.itecvv);

    mMediaPlayerControl = new MediaPlayerMultiControl(mAndroidVideoView, mItecVideoView);
    mMediaController = new MediaController(this);
    mMediaController.setAnchorView(findViewById(R.id.container));
    mMediaController.setMediaPlayer(mMediaPlayerControl);

    mPath = getIntent().getStringExtra("play");
    mTitle = getIntent().getStringExtra("play");
    if(StringUtils.isHttp(mPath)) {
        if (!checkWifi()) {
            ToastUtil.showMessage(getString(R.string.network_waste));
            wifiStateDlg();
            return;
        }
    }

    loadVideo();
}
 
开发者ID:zhangjingpu,项目名称:youkes_vr,代码行数:27,代码来源:SideBySideVideoPlayActivity.java

示例6: onResume

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    // ReceiverをRegister
    IntentFilter mIntentFilter = new IntentFilter();
    mIntentFilter.addAction(VideoConst.SEND_HOSTDP_TO_VIDEOPLAYER);
    registerReceiver(mReceiver, mIntentFilter);

    MediaController mMediaController = new MediaController(this);
    mMediaController.setVisibility(View.GONE);
    mMediaController.setAnchorView(mVideoView);

    mVideoView.setMediaController(mMediaController);
    mVideoView.setKeepScreenOn(true);
    mVideoView.setVideoURI(mUri);
    mVideoView.requestFocus();
    mVideoView.setOnCompletionListener(this);
    mVideoView.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(final MediaPlayer mp) {
            mVideoView.start();
            mIsReady = true;
        }
    });
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:26,代码来源:VideoPlayer.java

示例7: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    mVideo = (Video)getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    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);

    preparePlayer();
}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:20,代码来源:PlayerActivity.java

示例8: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    mVideo = (Video) getIntent().getSerializableExtra(Video.INTENT_EXTRA_VIDEO);

    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);

    preparePlayer();
}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:20,代码来源:PlayerActivity.java

示例9: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.rsb_activity_video_viewer);

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

    MediaController mediaController = new MediaController(this, false);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);

    try {
        String videoPath = getIntent().getStringExtra(KEY_RELATIVE_PATH);
        AssetFileDescriptor afd = getAssets().openFd(videoPath);
        videoView.setVideoDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
        videoView.start();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:ResearchStack,项目名称:ResearchStack,代码行数:21,代码来源:ViewVideoActivity.java

示例10: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferencesState.getInstance().initalizateActivityDependencies();
    setContentView(R.layout.video_activity);

    //Displays a video file.
    MediaController mediaController = new MediaController(VideoActivity.this);
    mVideoView = (VideoView) findViewById(R.id.videoview);
    String videoPathParam = getIntent().getStringExtra(VIDEO_PATH_PARAM);
    File file = new File(videoPathParam);
    if (file.exists()) {
        mVideoView.setVideoPath(videoPathParam);
    } else {
        mVideoView.setVideoURI(FileIOUtils.getRawUri(videoPathParam));
    }
    mVideoView.setMediaController(mediaController);
    mediaController.setAnchorView(mVideoView);

    mVideoView.requestFocus();
    if (savedInstanceState != null) {
        mVideoView.seekTo(savedInstanceState.getInt("video", 0));
    }
    mVideoView.start();
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:26,代码来源:VideoActivity.java

示例11: fromListView

import android.widget.MediaController; //导入方法依赖的package包/类
public void fromListView(String url) {

		//VideoView vidView = (VideoView) findViewById(R.id.videoView1);
		
		MediaController vidControl = new MediaController(this);
		vidControl.setAnchorView(view);
		view.setMediaController(vidControl);
		if (url != null) {
			//videoPath.setText(url);
			view.setVideoPath(url);
		} else {
			view.setVideoPath("/sdcard/Download/Home/Home.mp4");
		}
		view.start();

	}
 
开发者ID:kevalbhatt,项目名称:learn-android-examples,代码行数:17,代码来源:VideoManager.java

示例12: init

import android.widget.MediaController; //导入方法依赖的package包/类
/**
 * Initializes the video view. Is called by {@link APWidgetContainer} 
 * as it is added to it.
 */
public void init(PApplet pApplet) {
	this.pApplet = pApplet;

	if (view == null) {
		view = new MyVideoView(pApplet);
	}
	((VideoView) view).setZOrderMediaOverlay(true);

	if (hasMediaController) {
		MediaController mediaController = new MediaController(pApplet);
		mediaController.setAnchorView(((VideoView) view));

		((VideoView) view).setMediaController(mediaController);
	}
	if (videoPath != null) {
		((VideoView) view).setVideoPath(videoPath);
	}
	((VideoView) view).setOnCompletionListener(this);
	((VideoView) view).setOnPreparedListener(this);
	((VideoView) view).setOnErrorListener(this);

	super.init(pApplet);
}
 
开发者ID:MeULEDs,项目名称:apwidgets,代码行数:28,代码来源:APVideoView.java

示例13: 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;
}
 
开发者ID:protyposis,项目名称:MediaPlayer-Extended,代码行数:24,代码来源:VideoViewActivity.java

示例14: play

import android.widget.MediaController; //导入方法依赖的package包/类
private void play() {
	mProgressBar.setVisibility(View.VISIBLE);
	Uri videoUri = Uri.parse(mVideoUrl);
	try {
		mVideoView.setOnCompletionListener(this);
		mVideoView.setOnPreparedListener(this);
		mVideoView.setOnErrorListener(this);
		mVideoView.setVideoURI(videoUri);
		mMediaController = new MediaController(this);
		mMediaController.setAnchorView(mVideoView);
		mMediaController.setMediaPlayer(mVideoView);
		if (!mControls) {
			mMediaController.setVisibility(View.GONE);
		}
		mVideoView.setMediaController(mMediaController);
	} catch (Throwable t) {
		Log.d(TAG, t.toString());
	}
}
 
开发者ID:nchutchind,项目名称:cordova-plugin-streaming-media,代码行数:20,代码来源:SimpleVideoStream.java

示例15: onCreate

import android.widget.MediaController; //导入方法依赖的package包/类
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_simple_video_player);
        VideoView videoView =(VideoView)findViewById(R.id.simple_video_player_video_view);
        MediaController mediaController= new MediaController(this);
        mediaController.setAnchorView(videoView);
//        Uri uri= Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.test_video);
//        videoView.setMediaController(mediaController);
//        videoView.setVideoURI(uri);
//        videoView.requestFocus();
//
//        videoView.start();


    }
 
开发者ID:unfoldingWord-dev,项目名称:uw-android,代码行数:17,代码来源:SimpleVideoPlayerActivity.java


注:本文中的android.widget.MediaController.setAnchorView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。