Back to project page PlayerHater.
The source code is released under:
Apache License
If you think the Android project PlayerHater listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/******************************************************************************* * Copyright 2013 Chris Rhoden, Rebecca Nesson, Public Radio Exchange * /*ww w. ja v a 2s . co m*/ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package org.prx.playerhater.mediaplayer; import java.io.IOException; import android.content.Context; import android.media.MediaPlayer; import android.media.MediaPlayer.OnBufferingUpdateListener; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnInfoListener; import android.media.MediaPlayer.OnPreparedListener; import android.media.MediaPlayer.OnSeekCompleteListener; import android.net.Uri; public abstract class Player { public static interface StateChangeListener { public void onStateChanged(Player mediaPlayer, int state); } public abstract void reset(); public abstract void release(); public abstract void prepareAsync() throws IllegalStateException; public abstract void start() throws IllegalStateException; public abstract void pause() throws IllegalStateException; public abstract void stop() throws IllegalStateException; public abstract void seekTo(int msec); public abstract boolean isPlaying(); public abstract int getCurrentPosition(); public abstract int getDuration(); public abstract void setAudioStreamType(int streamtype); public abstract void setDataSource(Context context, Uri uri) throws IllegalStateException, IOException, IllegalArgumentException, SecurityException; public abstract void setOnErrorListener(OnErrorListener errorListener); public abstract void setOnPreparedListener( OnPreparedListener preparedListener); public abstract void setOnBufferingUpdateListener( OnBufferingUpdateListener bufferingUpdateListener); public abstract void setOnCompletionListener( OnCompletionListener completionListener); public abstract void setOnInfoListener(OnInfoListener infoListener); public abstract void setOnSeekCompleteListener( OnSeekCompleteListener seekCompleteListener); public abstract void setVolume(float leftVolume, float rightVolume); public abstract boolean equals(MediaPlayer mp); /* Stately API */ public int getState() { throw new IllegalStateException("This player isn't stately enough."); } public void setStateChangeListener(StateChangeListener listener) { throw new IllegalStateException("This player isn't stately enough."); } public String getStateName() { throw new IllegalStateException("This player isn't stately enough."); } /* Synchronous API */ public boolean prepare(Context context, Uri uri) { throw new IllegalStateException( "This player isn't down with synchronous calls."); } public boolean prepareAndPlay(Context applicationContext, Uri uri, int position) { throw new IllegalStateException( "This player isn't down with synchronous calls."); } public boolean conditionalPause() { throw new IllegalStateException( "This player isn't down with synchronous calls."); } public boolean conditionalStop() { throw new IllegalStateException( "This player isn't down with synchronous calls."); } public boolean conditionalPlay() { throw new IllegalStateException( "This player isn't down with synchronous calls."); } public boolean isWaitingToPlay() { return false; } public int getStateMask() { return getState(); } }