Java 类android.media.MediaPlayer.OnPreparedListener 实例源码

项目:DeviceConnect-Android    文件:VideoPlayer.java   
@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;
        }
    });
}
项目:Android-Birdcopy-Application    文件:MediaHolder.java   
private void initMediaPlayer(){

    Log.d(TAG, "path: " + videFilePath);
    File videoFile = new File(videFilePath);
       FileInputStream fis;
    try {
        fis = new FileInputStream(videoFile);
        mMediaPlayer.setDataSource(fis.getFD());
           mMediaPlayer.prepareAsync();
           mMediaPlayer.setOnPreparedListener(new OnPreparedListener() {
               @Override
               public void onPrepared(MediaPlayer mp) {
                   cancelWaitDialog();
                   if(autoPlayFlagMP){
                       mMediaPlayer.start();
                       setSurfaceViewScale();
                   }
               }
           });
           mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    } catch (IOException e) {
        Log.e(TAG,"Problem with input stream!",e);
           videoView.setVisibility(View.GONE);
           errorTextView.setVisibility(View.VISIBLE);
    }
}
项目:Android-Basics-Codes    文件:MusicService.java   
public void play(){
        //�������״̬
        player.reset();
        try {
            //����Ҫ���ŵ�����
            player.setDataSource("sdcard/zxmzf.mp3");
//          player.setDataSource("http://192.168.1.100:8080/bzj.mp3");
            //ͬ��׼��
//          player.prepare();
            //�첽׼��
            player.prepareAsync();
            player.setOnPreparedListener(new OnPreparedListener() {

                //�첽׼�����ʱ���˷�������
                @Override
                public void onPrepared(MediaPlayer mp) {
                    player.start();
                    addTimer();
                }
            });
//          player.start();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
    }
项目:BotLibre    文件:ChatActivity.java   
public void playVideo(String video, boolean loop) {
        if(!isPlaying){
            if (loop) {
                videoView.setOnPreparedListener(new OnPreparedListener() {
                    @Override
                    public void onPrepared(MediaPlayer mp) {
                        mp.setLooping(true);
                    }
                });
            }
            try {
                Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
                if (videoUri == null) {
                    if(MainActivity.online){videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());}
                }
                videoView.setVideoURI(videoUri);
                videoView.start();
            } catch (Exception exception) {
                Log.wtf(exception.toString(), exception);
            }
            isPlaying = true;//to Play this video only once.
        }
}
项目:BotLibre    文件:AvatarTestActivity.java   
public void playVideo(String video, boolean loop) {
    System.out.println("playVideo:" + video);
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        System.out.println("videoUri:" + videoUri);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
            System.out.println("null videoUri:" + videoUri);
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:BotLibre    文件:AvatarMediaActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:BotLibre    文件:ChatActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:BotLibre    文件:ChatActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:BotLibre    文件:AvatarTestActivity.java   
public void playVideo(String video, boolean loop) {
    System.out.println("playVideo:" + video);
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        System.out.println("videoUri:" + videoUri);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
            System.out.println("videoUri:" + videoUri);
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:BotLibre    文件:AvatarMediaActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:BotLibre    文件:GraphicMediaActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:snakk-ads-android-sdk    文件:TVASTTrackingVideoView.java   
private void init(TVASTPlayer player) {
    super.setOnCompletionListener(this);
    super.setOnErrorListener(this);

    this.mPlayer = player;

    OnPreparedListener preparedListener = new OnPreparedListener() {
        @Override
        public void onPrepared(final MediaPlayer mp) {
            for (TVASTAdPlayerListener callback : callbacks) {
                callback.onVideoPlay(mPlayer);
            }
        }
    };
    setOnPreparedListener(preparedListener);
}
项目:snakk-ads-android-sample-app    文件:TVASTTrackingVideoView.java   
private void init(TVASTPlayer player) {
    super.setOnCompletionListener(this);
    super.setOnErrorListener(this);

    this.mPlayer = player;

    OnPreparedListener preparedListener = new OnPreparedListener() {
        @Override
        public void onPrepared(final MediaPlayer mp) {
            for (TVASTAdPlayerListener callback : callbacks) {
                callback.onVideoPlay(mPlayer);
            }
        }
    };
    setOnPreparedListener(preparedListener);
}
项目:Project-Libre    文件:ChatActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:Project-Libre    文件:ChatActivity.java   
public void playVideo(String video, boolean loop) {
    if (loop) {
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
    }
    try {
        Uri videoUri = HttpGetVideoAction.fetchVideo(this, video);
        if (videoUri == null) {
            videoUri = Uri.parse(MainActivity.connection.fetchImage(video).toURI().toString());
        }
        videoView.setVideoURI(videoUri);
        videoView.start();
    } catch (Exception exception) {
        Log.wtf(exception.toString(), exception);
    }
}
项目:android-video-sync    文件:VideoActivity.java   
protected void onPostExecute(Integer msec) {
    videoView.seekTo(msec);

    try {
        Thread.sleep(pause*1000);  // this second is added to the startVideoTime
        videoView.start();
    } catch (InterruptedException e) {
        Logga.e(e.toString());
    }

    // if still experiencing delay, implement onSeekCompleteListener.

    videoView.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
}
项目:gundog-engine    文件:AndroidAudio.java   
private void prepare(String fileName, boolean looping) {
    Modules.LOG.info(TAG, "Preparing: " + fileName);
    try {
        mediaPlayer.reset();
        mediaPlayer.setLooping(looping);
        mediaPlayer.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mediaPlayer.start();
            }
        });
        AssetFileDescriptor afd = assetManager.openFd("music/" + fileName);
        mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
        mediaPlayer.prepareAsync();
        playing = fileName;
    } catch (Exception e) {
        Modules.LOG.error(TAG, e.toString());
    }
}
项目:boohee_v5.6    文件:VideoPlayerManager.java   
public static void initPlayer(VideoView videoView, OnPreparedListener onPreparedListener,
                              OnCompletionListener onCompletionListener, OnErrorListener
                                      onErrorListener) {
    if (onPreparedListener != null) {
        videoView.setOnPreparedListener(onPreparedListener);
    }
    if (onCompletionListener != null) {
        videoView.setOnCompletionListener(onCompletionListener);
    }
    if (onErrorListener != null) {
        videoView.setOnErrorListener(onErrorListener);
    }
}
项目:boohee_v5.6    文件:RestVideoPlayFragment.java   
private void playVideo() {
    if (!TextUtils.isEmpty(this.videoPath)) {
        this.restVideoView.setVideoPath(this.videoPath);
        this.restVideoView.setOnPreparedListener(new OnPreparedListener() {
            public void onPrepared(MediaPlayer mp) {
                mp.setLooping(true);
            }
        });
        this.restVideoView.start();
    }
}
项目:boohee_v5.6    文件:MentionPreviewActivity.java   
private void playVideo() {
    this.videoPath = this.videoDownloadHelper.getVideoName(this.ctx, this.currentMention.id);
    this.videoView.setVideoPath(this.videoPath);
    this.videoView.setOnPreparedListener(new OnPreparedListener() {
        public void onPrepared(MediaPlayer mp) {
            MentionPreviewActivity.this.progressLayout.setVisibility(8);
            mp.setLooping(true);
        }
    });
    this.videoView.start();
}
项目:FMTech    文件:duy.java   
public final void a(MediaPlayer.OnPreparedListener paramOnPreparedListener)
{
  this.d = paramOnPreparedListener;
  if (this.c != null) {
    this.c.setOnPreparedListener(this.d);
  }
}
项目:opensnap    文件:SnapEditorVidFrag.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup root, Bundle savedInstanceState) {
    setFocused(true);

    final View v = inflater.inflate(R.layout.snap_edit_vid, null);

    VideoView vv = (VideoView)v.findViewById(R.id.snap_vid);
    vv.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer player) {
            mMediaPlayer = player;
            player.setLooping(true);
            player.start();
        }
    });
    vv.setVideoPath(getFilePath());
    vv.setOnTouchListener(mediaOnTouchListener);

    mCaption = (EditText)v.findViewById(R.id.snap_user_text);
    mCaption.addTextChangedListener(captionTextWatcher);
    mCaption.setOnTouchListener(captionOnTouchListener);

    View cancel = (View)v.findViewById(R.id.back_button);
    cancel.setOnClickListener(cancelOnClickListener);

    View send = (View)v.findViewById(R.id.send_button);
    send.setOnClickListener(sendOnClickListener);

    return v;
}
项目:mHealthDroid    文件:Audio.java   
/**
    * Method to reproduce audio when the player is prepared
    */
public void play() {

    mediaPlayer.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mediaPlayer.start();
        }
    });
}
项目:silent-text-android    文件:AudioPlayer.java   
@Override
public void onPrepared( MediaPlayer player ) {
    controller.setMediaPlayer( this );
    for( int i = 0; i < onPreparedListeners.size(); i++ ) {
        OnPreparedListener onPreparedListener = onPreparedListeners.get( i );
        if( onPreparedListener != null ) {
            onPreparedListener.onPrepared( player );
        }
    }
}
项目:android-video-sync    文件:VideoForwardActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video_forward);

    actionBar = getActionBar();
    actionBar.hide();

    videoView = (VideoView) findViewById(R.id.videoForwardView);
    String path = "android.resource://" + getPackageName() + "/" + R.raw.tl;
    videoView.setVideoURI(Uri.parse(path));
    videoView.start();

    videoView.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });

    forward = (Button) findViewById(R.id.video_forward_button);
    forward.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Logga.i("forward button");
            videoView.seekTo(5000);
            videoView.start();
        }
    });
}
项目:Android-Media-Helper    文件:ImageUploaderActivityVideo.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.choosevideo);
    uploadEngine = new MediaEngine.Builder(this, savedInstanceState).setLoadingListener(this).build();
    ( (VideoView) findViewById(R.id.video) ).setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.start();
        }
    });
}
项目:Android-Media-Helper    文件:ImageUploaderActivitySupportVideo.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.choosevideo);
    uploadEngine = new MediaEngine.Builder(this, savedInstanceState).setLoadingListener(this).build();
    ( (VideoView) findViewById(R.id.video) ).setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.start();
        }
    });
}
项目:RoviRunner    文件:MediaPlayerPresenterTest.java   
public void testLifecycleStart()
{
    m_presenter.lifecycleStart();

    Mockito.verify( m_presenter ).makeNewMediaPlayer();
    Mockito.verify( m_player ).setOnPreparedListener( Mockito.any( OnPreparedListener.class ) );
}
项目:letv    文件:VideoViewH264m3u8.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264LeMobile.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264m3u8Hw.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264m3u8HwLeMobile.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264mp4.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewTV.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264m3u8_4D.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264LeMobile_4D.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264mp4_4D.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:VideoViewH264m3u8Hw_4D.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}
项目:letv    文件:FFMpegPlayer.java   
public void setOnPreparedListener(OnPreparedListener listener) {
    this.mOnPreparedListener = listener;
}
项目:boohee_v5.6    文件:PureVideoView.java   
public void setOnPreparedListener(OnPreparedListener l) {
    this.mOnPreparedListener = l;
}