1b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson/* 2b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * Copyright (C) 2011 The Android Open Source Project 3b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * 4b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * Licensed under the Apache License, Version 2.0 (the "License"); 5b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * you may not use this file except in compliance with the License. 6b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * You may obtain a copy of the License at 7b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * 8b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * http://www.apache.org/licenses/LICENSE-2.0 9b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * 10b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * Unless required by applicable law or agreed to in writing, software 11b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * distributed under the License is distributed on an "AS IS" BASIS, 12b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * See the License for the specific language governing permissions and 14b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * limitations under the License. 15b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson */ 16b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson 17b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudsonpackage com.android.ex.variablespeed; 18b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson 19b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudsonimport android.content.Context; 20b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudsonimport android.media.MediaPlayer; 21b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudsonimport android.net.Uri; 22b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson 23b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudsonimport java.io.IOException; 24b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson 25b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson/** 26b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * Interface that supports a subset of the operations on {@link android.media.MediaPlayer}. 27b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * 28b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * <p>This subset is arbitrarily defined - at the moment it is the subset that the voicemail 29b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * playback requires.</p> 30b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * 31b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * <p>This interface exists to make alternate implementations to the standard media player 32b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson * swappable, as well as making it much easier to test code that directly uses a media player. 33b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson */ 34b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudsonpublic interface MediaPlayerProxy { 35b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void setOnErrorListener(MediaPlayer.OnErrorListener listener); 36b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void setOnCompletionListener(MediaPlayer.OnCompletionListener listener); 37b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void release(); 38b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void reset(); 39b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void setDataSource(String path) throws IllegalStateException, IOException; 40b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void setDataSource(Context context, Uri intentUri) throws IllegalStateException, IOException; 41b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void prepare() throws IOException; 42b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson int getDuration(); 43b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void seekTo(int startPosition); 44b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void start(); 45b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson boolean isPlaying(); 46b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson int getCurrentPosition(); 47b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson void pause(); 48dc442b4d99512bf7c41ee5ceae6c93a3c3568b57Flavio Lerda void setAudioStreamType(int streamType); 49b83ad73794088498d6d38cd3b4fc9311f505d051Hugo Hudson} 50