@Override public void onPrepared(MediaPlayer mp) { mediaPlayer.start(); mediacontroller.setMediaPlayer(this); mediacontroller.setAnchorView(findViewById(R.id.surfaceView)); mediacontroller.show(); }
@Override public void start() { mediaPlayer.start(); // plugin.CountPlay(getApplicationContext()); /*if (plugin.ElapsedTime() != 0) { PlaysText.setText("Plays: "+ plugin.CountPlay()); TimeElapsedText.setText("Time elapsed: "+ plugin.ElapsedTime() + "ms"); }*/ }
@Override public void surfaceCreated(SurfaceHolder holder) { // prepare for playback try { mediaPlayer = new CustomMediaPlayer(); mediaPlayer.setDisplay(vidHolder); mediaPlayer.setDataSource(videoURL); mediaPlayer.prepare(); mediaPlayer.setOnPreparedListener(this); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediacontroller = new MediaController(this); plugin = new MyPlugin(getApplication(), mediaPlayer); } catch (Exception e) { e.printStackTrace(); } }
@Override public boolean isPlaying() { return mediaPlayer.isPlaying(); }
@Override public void seekTo(int pos) { mediaPlayer.seekTo(pos); }
@Override public int getCurrentPosition() { return mediaPlayer.getCurrentPosition(); }
@Override public int getDuration() { return mediaPlayer.getDuration(); }
@Override public void pause() { mediaPlayer.pause(); // PausesText.setText("Pauses: " + plugin.CountPause()); // plugin.CountPause(getApplicationContext()); }