Search in sources :

Example 1 with OnPreparedListener

use of android.media.MediaPlayer.OnPreparedListener in project AndroidSDK-RecipeBook by gabu.

the class Recipe067 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mVideoView = (VideoView) findViewById(R.id.video_view);
    // MediaControllerを作って
    mMediaController = new MediaController(this);
    // MediaControllerセット
    mVideoView.setMediaController(mMediaController);
    // VideoViewで動画を再生する準備ができた時に
    // 呼び出されるリスナー
    mVideoView.setOnPreparedListener(new OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {
            // 3,4秒でMediaControllerが消えちゃうので
            // 常に表示させておきたいんだけど
            // showメソッドが期待通りに動作してくれない
            // durationは正しく取得できてる。
            int duration = mVideoView.getDuration();
            mMediaController.show(duration);
            // リファレンスを信じて0にしてもダメ
            //                mMediaController.show(0);
            // まぁ気にせず再生スタート!
            mVideoView.start();
        }
    });
}
Also used : MediaController(android.widget.MediaController) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) MediaPlayer(android.media.MediaPlayer)

Example 2 with OnPreparedListener

use of android.media.MediaPlayer.OnPreparedListener in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FingerprintLocationAnimationVideoView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    setSurfaceTextureListener(new SurfaceTextureListener() {

        private SurfaceTexture mTextureToDestroy = null;

        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
            setVisibility(View.INVISIBLE);
            Uri videoUri = getFingerprintLocationAnimation();
            if (mMediaPlayer != null) {
                mMediaPlayer.release();
            }
            if (mTextureToDestroy != null) {
                mTextureToDestroy.release();
                mTextureToDestroy = null;
            }
            mMediaPlayer = MediaPlayer.create(mContext, videoUri);
            mMediaPlayer.setSurface(new Surface(surfaceTexture));
            mMediaPlayer.setOnPreparedListener(new OnPreparedListener() {

                @Override
                public void onPrepared(MediaPlayer mediaPlayer) {
                    mediaPlayer.setLooping(true);
                }
            });
            mMediaPlayer.setOnInfoListener(new OnInfoListener() {

                @Override
                public boolean onInfo(MediaPlayer mediaPlayer, int what, int extra) {
                    if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) {
                        // Keep the view hidden until video starts
                        setVisibility(View.VISIBLE);
                    }
                    return false;
                }
            });
            mAspect = (float) mMediaPlayer.getVideoHeight() / mMediaPlayer.getVideoWidth();
            requestLayout();
            startAnimation();
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width, int height) {
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
            mTextureToDestroy = surfaceTexture;
            return false;
        }

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        }
    });
}
Also used : OnInfoListener(android.media.MediaPlayer.OnInfoListener) SurfaceTexture(android.graphics.SurfaceTexture) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) Uri(android.net.Uri) Surface(android.view.Surface) MediaPlayer(android.media.MediaPlayer)

Example 3 with OnPreparedListener

use of android.media.MediaPlayer.OnPreparedListener in project coursera-android by aporter.

the class AudioVideoVideoPlayActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // 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(AudioVideoVideoPlayActivity.this, true);
    mMediaController.setEnabled(false);
    mVideoView.setMediaController(mMediaController);
    mVideoView.setVideoURI(Uri.parse("android.resource://course.examples.AudioVideo.VideoPlay/raw/moon"));
    // Add an OnPreparedListener to enable the MediaController once the video is ready
    mVideoView.setOnPreparedListener(new OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            mMediaController.setEnabled(true);
        }
    });
}
Also used : MediaController(android.widget.MediaController) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) MediaPlayer(android.media.MediaPlayer)

Example 4 with OnPreparedListener

use of android.media.MediaPlayer.OnPreparedListener in project SimplifyReader by chentao0707.

the class YoukuBasePlayerActivity method initMediaPlayer.

private void initMediaPlayer() {
    //---------->内部使用
    //		mediaPlayerDelegate.mediaPlayer = BaseMediaPlayer.getInstance();
    mediaPlayerDelegate.mediaPlayer = RemoteInterface.baseMediaPlayer;
    mediaPlayerDelegate.mediaPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {

        @Override
        public void onBufferingUpdate(MediaPlayer mp, int percent) {
            if (onPause) {
                mp.release();
                return;
            }
            if (pluginManager == null)
                return;
            pluginManager.onBufferingUpdateListener(percent);
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnCompletionListener(new OnCompletionListener() {

        @Override
        public void onCompletion(MediaPlayer mp) {
            if (mediaPlayerDelegate != null)
                mediaPlayerDelegate.onComplete();
            if (mYoukuPlayerView != null)
                mYoukuPlayerView.setPlayerBlack();
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnErrorListener(new OnErrorListener() {

        @Override
        public boolean onError(MediaPlayer mp, int what, int extra) {
            Logger.d("PlayFlow", "播放器出现错误 MediaPlayer onError what=" + what + " !!!");
            if (mYoukuPlayerView != null)
                mYoukuPlayerView.setDebugText("出现错误-->onError:" + what);
            disposeAdErrorLoss(what);
            if (isAdPlayError(what)) {
                Logger.d("PlayFlow", "出现错误:" + what + " 处理结果:跳过广告播放");
                return loadingADOverTime();
            }
            if (mediaPlayerDelegate != null && !mYoukuPlayerView.realVideoStart) {
                runOnUiThread(new Runnable() {

                    public void run() {
                        detectPlugin();
                    }
                });
            }
            if (!isSendPlayBreakEvent && MediaPlayerConfiguration.getInstance().trackPlayError() && mYoukuPlayerView.realVideoStart && mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null) {
                final String videoUrl = mediaPlayerDelegate.videoInfo.getWeburl();
                final TaskSendPlayBreak task = new TaskSendPlayBreak(videoUrl);
                task.execute();
                isSendPlayBreakEvent = true;
            }
            if (mYoukuPlayerView.realVideoStart && mediaPlayerDelegate.isLoading)
                Track.onPlayLoadingEnd();
            onLoadingFailError();
            if (pluginManager == null) {
                Logger.d("PlayFlow", "onError出现错误:" + what + " pluginManager == null  return false");
                return false;
            }
            //Logger.d("PlayFlow", "出现错误:" + what + " 处理结果:去重�?);"
            int nowPostition = mediaPlayerDelegate.getCurrentPosition();
            if (nowPostition > 0) {
                position = nowPostition;
            }
            // 系统播放器错误特殊处�?
            if (what == -38 && !MediaPlayerProxyUtil.isUplayerSupported()) {
                what = MPPErrorCode.MEDIA_INFO_PLAY_UNKNOW_ERROR;
            }
            return pluginManager.onError(what, extra);
        }

        private boolean isAdPlayError(int what) {
            return what == MPPErrorCode.MEDIA_INFO_PREPARED_AD_CHECK || (what == MPPErrorCode.MEDIA_INFO_DATA_SOURCE_ERROR && !mediaPlayerDelegate.isAdvShowFinished()) || (what == MPPErrorCode.MEDIA_INFO_NETWORK_ERROR && mediaPlayerDelegate.isADShowing) || (what == MPPErrorCode.MEDIA_INFO_NETWORK_CHECK && mediaPlayerDelegate.isADShowing);
        }

        //广告损耗埋点使�?
        private void disposeAdErrorLoss(int what) {
            if (mediaPlayerDelegate == null || mediaPlayerDelegate.videoInfo == null) {
                return;
            }
            if (what == MPPErrorCode.MEDIA_INFO_DATA_SOURCE_ERROR && !mediaPlayerDelegate.videoInfo.isAdvEmpty()) {
                DisposableStatsUtils.disposeAdLoss(YoukuBasePlayerActivity.this, URLContainer.AD_LOSS_STEP4, SessionUnitil.playEvent_session, URLContainer.AD_LOSS_MF);
            }
            if (what == MPPErrorCode.MEDIA_INFO_PREPARED_AD_CHECK) {
                DisposableStatsUtils.disposeAdLoss(YoukuBasePlayerActivity.this, URLContainer.AD_LOSS_STEP6, SessionUnitil.playEvent_session, URLContainer.AD_LOSS_MF);
            }
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnPreparedListener(new OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            if (pluginManager == null)
                return;
            pluginManager.onPrepared();
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() {

        @Override
        public void onSeekComplete(MediaPlayer mp) {
            if (mediaPlayerDelegate != null) {
                mediaPlayerDelegate.isLoading = false;
            }
            Track.setTrackPlayLoading(true);
            if (pluginManager == null)
                return;
            runOnUiThread(new Runnable() {

                public void run() {
                    pluginManager.onSeekComplete();
                }
            });
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() {

        @Override
        public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
            if (pluginManager == null)
                return;
            pluginManager.onVideoSizeChanged(width, height);
            Logger.e(TAG, "onVideoSizeChanged-->" + width + height);
            mediaPlayerDelegate.mediaPlayer.updateWidthAndHeight(width, height);
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnTimeOutListener(new OnTimeoutListener() {

        @Override
        public void onTimeOut() {
            if (mediaPlayerDelegate == null)
                return;
            Logger.d("PlayFlow", "onTimeOut");
            mediaPlayerDelegate.release();
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    Track.pause();
                    onLoadingFailError();
                }
            });
            if (!isSendPlayBreakEvent && MediaPlayerConfiguration.getInstance().trackPlayError() && mYoukuPlayerView.realVideoStart && mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null) {
                final String videoUrl = mediaPlayerDelegate.videoInfo.getWeburl();
                final TaskSendPlayBreak task = new TaskSendPlayBreak(videoUrl);
                task.execute();
                isSendPlayBreakEvent = true;
            }
            runOnUiThread(new Runnable() {

                public void run() {
                    if (pluginManager == null)
                        return;
                    pluginManager.onTimeout();
                }
            });
        }

        @Override
        public void onNotifyChangeVideoQuality() {
            if (pluginManager == null)
                return;
            Logger.d("PlayFlow", "onNotifyChangeVideoQuality");
            pluginManager.onNotifyChangeVideoQuality();
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnCurrentPositionUpdateListener(new OnCurrentPositionUpdateListener() {

        @Override
        public void onCurrentPositionUpdate(final int currentPosition) {
            if (pluginManager == null)
                return;
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    try {
                        pluginManager.onCurrentPositionChange(currentPosition);
                    } catch (Exception e) {
                    }
                }
            });
        }
    });
    if (PlayerUtil.useUplayer()) {
        mediaPlayerDelegate.mediaPlayer.setOnADPlayListener(new OnADPlayListener() {

            @Override
            public boolean onStartPlayAD(int index) {
                Logger.d("PlayFlow", "onstartPlayAD");
                Track.onAdStart();
                String vid = "";
                if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null)
                    vid = mediaPlayerDelegate.videoInfo.getVid();
                Track.trackAdLoad(getApplicationContext(), vid);
                mYoukuPlayerView.setPlayerBlackGone();
                mPluginADPlay.setInteractiveAdVisible(false);
                if (mediaPlayerDelegate != null) {
                    mediaPlayerDelegate.isADShowing = true;
                    mediaPlayerDelegate.isAdStartSended = true;
                    if (mediaPlayerDelegate.videoInfo != null && mediaPlayerDelegate.videoInfo.videoAdvInfo != null) {
                        if (mediaPlayerDelegate.videoInfo.videoAdvInfo.SKIP != null && mediaPlayerDelegate.videoInfo.videoAdvInfo.SKIP.equals("1")) {
                            if (null != mPluginADPlay) {
                                mPluginADPlay.setSkipVisible(true);
                            }
                        }
                        if (mediaPlayerDelegate.videoInfo.videoAdvInfo.VAL.get(0).RST.equals("hvideo")) {
                            if (mPluginADPlay.isInteractiveAdShow()) {
                                mPluginADPlay.setInteractiveAdVisible(true);
                            } else {
                                String brs = mediaPlayerDelegate.videoInfo.videoAdvInfo.VAL.get(0).BRS;
                                int count = mediaPlayerDelegate.videoInfo.videoAdvInfo.VAL.get(0).AL;
                                mPluginADPlay.startInteractiveAd(brs, count);
                                mPluginADPlay.showInteractiveAd();
                            }
                        }
                    }
                }
                updatePlugin(PLUGIN_SHOW_AD_PLAY);
                if (null != pluginManager) {
                    runOnUiThread(new Runnable() {

                        public void run() {
                            pluginManager.onLoaded();
                            if (null != mPluginADPlay) {
                                mPluginADPlay.setVisible(true);
                            }
                        }
                    });
                }
                if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null) {
                    AnalyticsWrapper.adPlayStart(getApplicationContext(), mediaPlayerDelegate.videoInfo);
                }
                try {
                    DisposableStatsUtils.disposeSUS(mediaPlayerDelegate.videoInfo);
                } catch (NullPointerException e) {
                    Logger.e("sgh", e.toString());
                }
                if (mediaPlayerDelegate.videoInfo.getCurrentAdvInfo() != null && (mediaPlayerDelegate.videoInfo.getCurrentAdvInfo().VSC == null || mediaPlayerDelegate.videoInfo.getCurrentAdvInfo().VSC.equalsIgnoreCase(""))) {
                    DisposableStatsUtils.disposeVC(mediaPlayerDelegate.videoInfo);
                }
                return false;
            }

            @Override
            public boolean onEndPlayAD(int index) {
                Logger.d("PlayFlow", "onEndPlayAD");
                if (mediaPlayerDelegate != null) {
                    mediaPlayerDelegate.isADShowing = false;
                }
                Track.onAdEnd();
                if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null) {
                    AnalyticsWrapper.adPlayEnd(getApplicationContext(), mediaPlayerDelegate.videoInfo);
                }
                // 必须在removePlayedAdv之前调用
                DisposableStatsUtils.disposeSUE(mediaPlayerDelegate.videoInfo);
                // 当前广告成功播放完成后,从容器中移除
                mediaPlayerDelegate.videoInfo.removePlayedAdv();
                if (mediaPlayerDelegate.videoInfo.isCached()) {
                    ICacheInfo download = IMediaPlayerDelegate.mICacheInfo;
                    if (download != null) {
                        if (download.isDownloadFinished(mediaPlayerDelegate.videoInfo.getVid())) {
                            VideoCacheInfo downloadInfo = download.getDownloadInfo(mediaPlayerDelegate.videoInfo.getVid());
                            if (YoukuBasePlayerActivity.isHighEnd) {
                                mediaPlayerDelegate.videoInfo.cachePath = PlayerUtil.getM3u8File(downloadInfo.savePath + "youku.m3u8");
                            }
                        }
                    }
                }
                if (null != pluginManager) {
                    runOnUiThread(new Runnable() {

                        public void run() {
                            mPluginADPlay.closeInteractiveAdNotIcludeUI();
                            pluginManager.onLoading();
                        }
                    });
                }
                Logger.e(TAG, "onEndPlayAD");
                return false;
            }
        });
        mediaPlayerDelegate.mediaPlayer.setOnADCountListener(new OnADCountListener() {

            @Override
            public void onCountUpdate(final int count) {
                position = mediaPlayerDelegate.getCurrentPosition();
                final int currentPosition = mediaPlayerDelegate.getCurrentPosition() / 1000;
                runOnUiThread(new Runnable() {

                    public void run() {
                        mPluginADPlay.notifyUpdate(count);
                        mYoukuPlayerView.resizeMediaPlayer(false);
                        DisposableStatsUtils.disposeSU(mediaPlayerDelegate.videoInfo, currentPosition);
                    }
                });
            }
        });
        mediaPlayerDelegate.mediaPlayer.setOnNetworkSpeedListener(new OnNetworkSpeedListener() {

            @Override
            public void onSpeedUpdate(final int count) {
                if (null != pluginManager) {
                    runOnUiThread(new Runnable() {

                        public void run() {
                            pluginManager.onNetSpeedChange(count);
                        }
                    });
                }
            }
        });
    }
    mediaPlayerDelegate.mediaPlayer.setOnRealVideoStartListener(new OnRealVideoStartListener() {

        @Override
        public void onRealVideoStart() {
            if (onPause)
                return;
            // 这个listener的理解是正片开始播放的时候调�?这个时候的
            // mediaPlayerDelegate为空的概率比较大
            Logger.d("PlayFlow", "正片开始播放,没有错误");
            Track.isRealVideoStarted = true;
            String vid = "";
            if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null)
                vid = mediaPlayerDelegate.videoInfo.getVid();
            Track.onRealVideoFirstLoadEnd(getApplicationContext(), vid);
            localStartSetDuration();
            sentonVVBegin();
            mYoukuPlayerView.setPlayerBlackGone();
            if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null) {
                mediaPlayerDelegate.isADShowing = false;
                Logger.e(TAG, "onRealVideoStart" + mediaPlayerDelegate.videoInfo.IsSendVV);
            } else {
                Logger.e(TAG, "onRealVideoStart mediaPlayerDelegate空指");
            }
            mediaPlayerDelegate.isLoading = false;
            if (null != pluginManager) {
                runOnUiThread(new Runnable() {

                    public void run() {
                        detectPlugin();
                        pluginManager.onRealVideoStart();
                        pluginManager.onLoaded();
                    }
                });
            }
            if (mediaPlayerDelegate != null) {
                if (mediaPlayerDelegate.videoInfo != null && mediaPlayerDelegate.videoInfo.getProgress() > 1000 && !mediaPlayerDelegate.videoInfo.isHLS) {
                    mediaPlayerDelegate.seekTo(mediaPlayerDelegate.videoInfo.getProgress());
                    Logger.e("PlayFlow", "SEEK TO" + mediaPlayerDelegate.videoInfo.getProgress());
                }
            }
            runOnUiThread(new Runnable() {

                public void run() {
                    if (mInvestigate != null) {
                        mInvestigate.show();
                    }
                }
            });
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnLoadingStatusListener(new OnLoadingStatusListener() {

        @Override
        public void onStartLoading() {
            Logger.e(TAG, "onStartLoading");
            if (pluginManager == null || onPause)
                return;
            Track.onPlayLoadingStart(mediaPlayerDelegate.mediaPlayer.getCurrentPosition());
            if (mediaPlayerDelegate != null) {
                mediaPlayerDelegate.isLoading = true;
            }
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (pluginManager == null)
                        return;
                    pluginManager.onLoading();
                    if (PlayerUtil.useUplayer() && !mediaPlayerDelegate.videoInfo.isUseCachePath())
                        mediaPlayerDelegate.loadingPause();
                }
            });
        }

        @Override
        public void onEndLoading() {
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (pluginManager == null)
                        return;
                    pluginManager.onLoaded();
                }
            });
            Track.onPlayLoadingEnd();
            if (null != mediaPlayerDelegate) {
                mediaPlayerDelegate.isStartPlay = true;
                mediaPlayerDelegate.isLoading = false;
                if (null != mediaPlayerDelegate.videoInfo) {
                    id = mediaPlayerDelegate.videoInfo.getVid();
                    mediaPlayerDelegate.videoInfo.isFirstLoaded = true;
                }
                // 本地mp4不控制自动开�?
                if (PlayerUtil.useUplayer() && !mediaPlayerDelegate.videoInfo.isUseCachePath())
                    mediaPlayerDelegate.start();
            }
            if (!firstLoaded && !isFromLocal() && !PreferenceUtil.getPreferenceBoolean(YoukuBasePlayerActivity.this, "video_lock", false)) {
                if (mediaPlayerDelegate != null && !mediaPlayerDelegate.isFullScreen && mediaPlayerDelegate.videoInfo != null && StaticsUtil.PLAY_TYPE_LOCAL.equals(mediaPlayerDelegate.videoInfo.getPlayType()) || !PlayerUtil.isYoukuTablet(YoukuBasePlayerActivity.this)) {
                    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
                }
                Logger.d("lelouch", "onLoaded setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);");
                firstLoaded = true;
            }
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnPlayHeartListener(new OnPlayHeartListener() {

        @Override
        public void onPlayHeart() {
            if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null)
                Track.trackPlayHeart(getApplicationContext(), mediaPlayerDelegate.videoInfo, mediaPlayerDelegate.isFullScreen);
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnVideoIndexUpdateListener(new OnVideoIndexUpdateListener() {

        @Override
        public void onVideoIndexUpdate(int currentIndex, int ip) {
            Logger.d("PlayFlow", "onVideoIndexUpdate:" + currentIndex + "  " + ip);
            if (mediaPlayerDelegate != null && mediaPlayerDelegate.videoInfo != null)
                Track.onVideoIndexUpdate(getApplicationContext(), currentIndex, ip, mediaPlayerDelegate.videoInfo.getCurrentQuality());
        }
    });
    mediaPlayerDelegate.mediaPlayer.setOnHwDecodeErrorListener(new OnHwDecodeErrorListener() {

        @Override
        public void OnHwDecodeError() {
            Logger.d("PlayFlow", "OnHwDecodeError");
            //						DisposableHttpTask task = new DisposableHttpTask(
            //								URLContainer.getHwErrorUrl());
            //						task.setRequestMethod(DisposableHttpTask.METHOD_POST);
            //						task.start();
            MediaPlayerConfiguration.getInstance().setUseHardwareDecode(false);
        }
    });
}
Also used : OnLoadingStatusListener(com.youku.uplayer.OnLoadingStatusListener) VideoCacheInfo(com.youku.player.module.VideoCacheInfo) OnNetworkSpeedListener(com.youku.uplayer.OnNetworkSpeedListener) OnADCountListener(com.youku.uplayer.OnADCountListener) ICacheInfo(com.youku.player.apiservice.ICacheInfo) OnRealVideoStartListener(com.youku.uplayer.OnRealVideoStartListener) OnSeekCompleteListener(android.media.MediaPlayer.OnSeekCompleteListener) OnADPlayListener(com.youku.uplayer.OnADPlayListener) TaskSendPlayBreak(com.youku.statistics.TaskSendPlayBreak) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) OnHwDecodeErrorListener(com.youku.uplayer.OnHwDecodeErrorListener) OnVideoIndexUpdateListener(com.youku.uplayer.OnVideoIndexUpdateListener) OnCurrentPositionUpdateListener(com.youku.uplayer.OnCurrentPositionUpdateListener) SuppressLint(android.annotation.SuppressLint) UnsupportedEncodingException(java.io.UnsupportedEncodingException) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) OnErrorListener(android.media.MediaPlayer.OnErrorListener) OnCompletionListener(android.media.MediaPlayer.OnCompletionListener) OnTimeoutListener(com.youku.uplayer.OnTimeoutListener) OnPlayHeartListener(com.youku.player.ui.interf.IBaseMediaPlayer.OnPlayHeartListener) OnBufferingUpdateListener(android.media.MediaPlayer.OnBufferingUpdateListener) OnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener) MediaPlayer(android.media.MediaPlayer)

Example 5 with OnPreparedListener

use of android.media.MediaPlayer.OnPreparedListener in project AndroidSDK-RecipeBook by gabu.

the class Recipe068 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // フルスクリーン表示にします
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // タイトルバーを非表示にします
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
    mVideoView = (VideoView) findViewById(R.id.video_view);
    mMediaController = new MediaController(this);
    mVideoView.setMediaController(mMediaController);
    mVideoView.setOnPreparedListener(new OnPreparedListener() {

        public void onPrepared(MediaPlayer mp) {
            mVideoView.start();
            showTelop();
        }
    });
    mFrameLayout = (FrameLayout) findViewById(R.id.frame_layout);
}
Also used : MediaController(android.widget.MediaController) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) MediaPlayer(android.media.MediaPlayer)

Aggregations

MediaPlayer (android.media.MediaPlayer)7 OnPreparedListener (android.media.MediaPlayer.OnPreparedListener)7 MediaController (android.widget.MediaController)3 OnCompletionListener (android.media.MediaPlayer.OnCompletionListener)2 SuppressLint (android.annotation.SuppressLint)1 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 SurfaceTexture (android.graphics.SurfaceTexture)1 OnBufferingUpdateListener (android.media.MediaPlayer.OnBufferingUpdateListener)1 OnErrorListener (android.media.MediaPlayer.OnErrorListener)1 OnInfoListener (android.media.MediaPlayer.OnInfoListener)1 OnSeekCompleteListener (android.media.MediaPlayer.OnSeekCompleteListener)1 OnVideoSizeChangedListener (android.media.MediaPlayer.OnVideoSizeChangedListener)1 SoundPool (android.media.SoundPool)1 Uri (android.net.Uri)1 Surface (android.view.Surface)1 ICacheInfo (com.youku.player.apiservice.ICacheInfo)1 VideoCacheInfo (com.youku.player.module.VideoCacheInfo)1 OnPlayHeartListener (com.youku.player.ui.interf.IBaseMediaPlayer.OnPlayHeartListener)1 TaskSendPlayBreak (com.youku.statistics.TaskSendPlayBreak)1 OnADCountListener (com.youku.uplayer.OnADCountListener)1