Created
October 22, 2016 02:43
-
-
Save evanhalley/fe6c0973eb7e09a02c375aca0a0bdbba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Interface for interacting with a media player | |
* Created by evanhalley on 11/18/15. | |
*/ | |
public abstract class MediaPlayer { | |
protected PremoMediaPlayerListener mMediaPlayerListener; | |
protected ProgressUpdateListener mProgressUpdateListener; | |
public MediaPlayer(PremoMediaPlayerListener mediaPlayerListener, | |
ProgressUpdateListener progressUpdateListener) { | |
mMediaPlayerListener = mediaPlayerListener; | |
mProgressUpdateListener = progressUpdateListener; | |
} | |
public void tearDown() { | |
mMediaPlayerListener = null; | |
mProgressUpdateListener = null; | |
} | |
public abstract void loadEpisode(Episode episode); | |
public abstract void startPlayback(boolean playImmediately); | |
public abstract void resumePlayback(); | |
public abstract void pausePlayback(); | |
public abstract void stopPlayback(); | |
public abstract void seekTo(long position); | |
public abstract boolean isStreaming(); | |
public abstract int getState(); | |
public abstract long getCurrentPosition(); | |
public abstract long getDuration(); | |
public abstract long getBufferedPosition(); | |
public abstract void setPlaybackSpeed(float speed); | |
/** | |
* Used to listen for media player state changes | |
* Created by evanhalley on 11/18/15. | |
*/ | |
public interface PremoMediaPlayerListener { | |
void onStateChanged(int state); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment