Search in sources :

Example 6 with AssetFileDescriptor

use of android.content.res.AssetFileDescriptor in project VideoPlayerManager by danylovolokh.

the class MediaPlayerWrapperResetTest method testResetStopped.

@Test
public void testResetStopped() throws Exception {
    mMediaPlayerWrapper.setDataSource(new AssetFileDescriptor(ParcelFileDescriptor.adoptFd(0), 0, 0));
    mMediaPlayerWrapper.prepare();
    mMediaPlayerWrapper.start();
    mMediaPlayerWrapper.stop();
    assertEquals(MediaPlayerWrapper.State.STOPPED, mMediaPlayerWrapper.getCurrentState());
    mMediaPlayerWrapper.reset();
    assertEquals(MediaPlayerWrapper.State.IDLE, mMediaPlayerWrapper.getCurrentState());
}
Also used : AssetFileDescriptor(android.content.res.AssetFileDescriptor) Test(org.junit.Test)

Example 7 with AssetFileDescriptor

use of android.content.res.AssetFileDescriptor in project VideoPlayerManager by danylovolokh.

the class MediaPlayerWrapperResetTest method testResetInitialized.

@Test
public void testResetInitialized() throws Exception {
    mMediaPlayerWrapper.setDataSource(new AssetFileDescriptor(ParcelFileDescriptor.adoptFd(0), 0, 0));
    assertEquals(MediaPlayerWrapper.State.INITIALIZED, mMediaPlayerWrapper.getCurrentState());
    mMediaPlayerWrapper.reset();
    assertEquals(MediaPlayerWrapper.State.IDLE, mMediaPlayerWrapper.getCurrentState());
}
Also used : AssetFileDescriptor(android.content.res.AssetFileDescriptor) Test(org.junit.Test)

Example 8 with AssetFileDescriptor

use of android.content.res.AssetFileDescriptor in project VideoPlayerManager by danylovolokh.

the class MediaPlayerWrapperResetTest method testResetPaused.

@Test
public void testResetPaused() throws Exception {
    mMediaPlayerWrapper.setDataSource(new AssetFileDescriptor(ParcelFileDescriptor.adoptFd(0), 0, 0));
    mMediaPlayerWrapper.prepare();
    mMediaPlayerWrapper.start();
    mMediaPlayerWrapper.pause();
    assertEquals(MediaPlayerWrapper.State.PAUSED, mMediaPlayerWrapper.getCurrentState());
    mMediaPlayerWrapper.reset();
    assertEquals(MediaPlayerWrapper.State.IDLE, mMediaPlayerWrapper.getCurrentState());
}
Also used : AssetFileDescriptor(android.content.res.AssetFileDescriptor) Test(org.junit.Test)

Example 9 with AssetFileDescriptor

use of android.content.res.AssetFileDescriptor in project VideoPlayerManager by danylovolokh.

the class MediaPlayerWrapperStartTest method testStartInitialized.

@Test
public void testStartInitialized() throws Exception {
    mMediaPlayerWrapper.setDataSource(new AssetFileDescriptor(ParcelFileDescriptor.adoptFd(0), 0, 0));
    assertEquals(MediaPlayerWrapper.State.INITIALIZED, mMediaPlayerWrapper.getCurrentState());
    tryToFailStart(MediaPlayerWrapper.State.INITIALIZED);
}
Also used : AssetFileDescriptor(android.content.res.AssetFileDescriptor) Test(org.junit.Test)

Example 10 with AssetFileDescriptor

use of android.content.res.AssetFileDescriptor in project VideoPlayerManager by danylovolokh.

the class MediaPlayerWrapperStartTest method testStartStarted.

@Test
public void testStartStarted() throws Exception {
    mMediaPlayerWrapper.setDataSource(new AssetFileDescriptor(ParcelFileDescriptor.adoptFd(0), 0, 0));
    mMediaPlayerWrapper.prepare();
    mMediaPlayerWrapper.start();
    assertEquals(MediaPlayerWrapper.State.STARTED, mMediaPlayerWrapper.getCurrentState());
    tryToFailStart(MediaPlayerWrapper.State.STARTED);
}
Also used : AssetFileDescriptor(android.content.res.AssetFileDescriptor) Test(org.junit.Test)

Aggregations

AssetFileDescriptor (android.content.res.AssetFileDescriptor)187 IOException (java.io.IOException)98 ParcelFileDescriptor (android.os.ParcelFileDescriptor)49 FileNotFoundException (java.io.FileNotFoundException)41 Test (org.junit.Test)28 MediaPlayer (android.media.MediaPlayer)27 ContentResolver (android.content.ContentResolver)26 RemoteException (android.os.RemoteException)19 File (java.io.File)18 FileInputStream (java.io.FileInputStream)16 Nullable (android.annotation.Nullable)15 Parcel (android.os.Parcel)14 Bitmap (android.graphics.Bitmap)13 FileDescriptor (java.io.FileDescriptor)13 DeadObjectException (android.os.DeadObjectException)12 Resources (android.content.res.Resources)11 FileOutputStream (java.io.FileOutputStream)11 InputStream (java.io.InputStream)11 Uri (android.net.Uri)10 Bundle (android.os.Bundle)10