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


Java MediaController.setEnabled方法代码示例

本文整理汇总了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;
}
 
开发者ID:protyposis,项目名称:MediaPlayer-Extended,代码行数:24,代码来源:VideoViewActivity.java

示例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);
}
 
开发者ID:protyposis,项目名称:Spectaculum,代码行数:12,代码来源:SpectaculumDemoBaseActivity.java

示例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);
        }
    });
}
 
开发者ID:abdulla-alali,项目名称:lecture_examples,代码行数:32,代码来源:VideoPlayActivity.java

示例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);
}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:31,代码来源:PlayerActivity.java

示例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);
}
 
开发者ID:succlz123,项目名称:OkPlayer,代码行数:12,代码来源:OkVideoView.java

示例6: setupMediaController

import android.widget.MediaController; //导入方法依赖的package包/类
protected void setupMediaController() {
	mMediaController = new MediaController( this );
	mMediaController.setEnabled(true);
	mMediaController.show();
	mMediaController.setMediaPlayer( mVideoView );
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:7,代码来源:VideoPlayerActivity.java

示例7: createController

import android.widget.MediaController; //导入方法依赖的package包/类
protected void createController() {
	controller = new MediaController( getActivity() );
	controller.setAnchorView( getUnwrappedView() );
	controller.setMediaPlayer( playerWrapper );
	controller.setEnabled( true );
}
 
开发者ID:SilentCircle,项目名称:silent-text-android,代码行数:7,代码来源:MediaPlayerFragmentICS.java

示例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();
    }
}
 
开发者ID:TByron,项目名称:Jupiter-Broadcasting-Holo,代码行数:44,代码来源:JBPlayer.java


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