Android Open Source - mclib I Audio Player






From Project

Back to project page mclib.

License

The source code is released under:

Apache License, Version 2.0 FoundationProjectsPeopleGet InvolvedDownloadSupport ApacheHome ? Licenses Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITION...

If you think the Android project mclib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
   Copyright 2012 Mikhail Chabanov//  w ww. j a v  a2s.  c om

   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 mc.lib.audio;

import java.io.File;
import java.io.InputStream;

import mc.lib.interfaces.OnCompleteListener;
import mc.lib.interfaces.OnProgressListener;
import android.content.res.AssetFileDescriptor;
import android.net.Uri;

public interface IAudioPlayer
{
    /**
     * Play audio from resource.
     * 
     * @param resId
     */
    void play(int resId);

    /**
     * Play audio from file.
     * 
     * @param filePath
     */
    void play(String filePath);

    /**
     * Play audio from file.
     * 
     * @param path
     */
    void play(File path);

    /**
     * Play audio from URI.
     * 
     * @param uri
     */
    void play(Uri uri);

    /**
     * Play audio from stream.
     * 
     * @param is
     */
    void play(InputStream is);

    /**
     * Play audio from file.
     * 
     * @param afd
     */
    void play(AssetFileDescriptor afd);

    /**
     * Play audio from resource. Start playing with specified position.
     * 
     * @param resId
     * @param startPos
     */
    void play(int resId, int startPos);

    /**
     * Play audio from file. Start playing with specified position.
     * 
     * @param filePath
     * @param startPos
     */
    void play(String filePath, int startPos);

    /**
     * Play audio from file. Start playing with specified position.
     * 
     * @param path
     * @param startPos
     */
    void play(File path, int startPos);

    /**
     * Play audio from URI. Start playing with specified position.
     * 
     * @param uri
     * @param startPos
     */
    void play(Uri uri, int startPos);

    /**
     * Play audio from stream. Start playing with specified position.
     * 
     * @param is
     * @param startPos
     */
    void play(InputStream is, int startPos);

    /**
     * Play audio from file. Start playing with specified position.
     * 
     * @param afd
     * @param startPos
     */
    void play(AssetFileDescriptor afd, int startPos);

    /**
     * Stop playing audio.
     */
    void stop();

    /**
     * Pause playing audio. Afterwards you can continue playing from the same position by calling resume method.
     */
    void pause();

    /**
     * If method pause was called previously then resume start playing from last playing position.
     */
    void resume();

    /**
     * Check if audio playing now.
     * 
     * @return true if audio playing now
     */
    boolean isPlaying();

    /**
     * Set playing volume.
     * 
     * @param volume
     */
    void setVolume(float volume);

    /**
     * 
     * @return true if playing repeatedly
     */
    boolean getRepeat();

    /**
     * If you set true then the same audio playing repeatedly until you stop playing or call other play method.
     * 
     * @param repeat
     */
    void setRepeat(boolean repeat);

    /**
     * 
     * @return total duration of audio playing now
     */
    int getDuration();

    /**
     * Get current player position.
     * 
     */
    int getPlayPosition();

    /**
     * Set current position to play.
     * 
     * @param position
     *            new play position in msec
     */
    void setPlayPosition(int position);

    /**
     * Get audio stream type.
     * 
     */
    int getAudioStreamType();

    /**
     * Set audio stream type.
     * 
     * @param streamType
     *            new audio stream type
     */
    void setAudioStreamType(int streamType);

    /**
     * 
     * @return OnCompleteListener or null if listener not set
     */
    OnCompleteListener<Class<?>> getOnCompleteListener();

    /**
     * Set OnCompleteListener to notify your app when playing complete.
     * 
     * @param listener
     */
    void setOnCompleteListener(OnCompleteListener<Class<?>> listener);

    /**
     * 
     * @return OnProgressListener or null if listener not set
     */
    OnProgressListener getOnProgressListener();

    /**
     * Set OnProgressListener to notify your app when playing progress is made.
     * 
     * @param listener
     */
    void setOnProgressListener(OnProgressListener listener);

    /**
     * Stop playing. Release all resources. It's strongly recommended to call it, when player won't be used any more.
     * 
     */
    public void close();
}




Java Source Code List

mc.lib.archives.ArchivesHelper.java
mc.lib.assets.AssetsHelper.java
mc.lib.audio.AudioSource.java
mc.lib.audio.IAudioPlayer.java
mc.lib.audio.MediaAudioPlayer.java
mc.lib.files.FileHelper.java
mc.lib.files.FileReadingHelper.java
mc.lib.files.PermissionHelper.java
mc.lib.identity.IdentityHelper.java
mc.lib.image.BitmapTools.java
mc.lib.image.ImageHelper.java
mc.lib.image.InputStreamFullSkip.java
mc.lib.interfaces.OnCompleteListener.java
mc.lib.interfaces.OnProgressListener.java
mc.lib.interfaces.OnStartListener.java
mc.lib.io.KeyboardHelper.java
mc.lib.io.ToastHelper.java
mc.lib.location.LocationHelper.java
mc.lib.location.OnLocationChangeListener.java
mc.lib.log.Log.java
mc.lib.network.AsyncFileDownloader.java
mc.lib.network.AsyncNetworkHelper.java
mc.lib.network.EmailHelper.java
mc.lib.network.NetworkHelper.java
mc.lib.regexp.PopularRegexp.java
mc.lib.regexp.Validator.java
mc.lib.screen.ScreenHelper.java
mc.lib.stream.AdvancedStreamHelper.java
mc.lib.stream.StreamHelper.java
mc.lib.video.BasicVideoPlayer.java
mc.lib.video.IVideoPlayer.java
mc.lib.video.VideoViewPlayer.java