Search in sources :

Example 31 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 32 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 33 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)

Example 34 with AssetFileDescriptor

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

the class MediaPlayerWrapperStopTest method testStopStopped.

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

Example 35 with AssetFileDescriptor

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

the class MediaPlayerWrapperStopTest method testStopInitialized.

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

Aggregations

AssetFileDescriptor (android.content.res.AssetFileDescriptor)189 IOException (java.io.IOException)100 ParcelFileDescriptor (android.os.ParcelFileDescriptor)49 FileNotFoundException (java.io.FileNotFoundException)41 MediaPlayer (android.media.MediaPlayer)28 Test (org.junit.Test)28 ContentResolver (android.content.ContentResolver)26 RemoteException (android.os.RemoteException)19 File (java.io.File)18 FileInputStream (java.io.FileInputStream)17 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 InputStream (java.io.InputStream)12 Resources (android.content.res.Resources)11 Uri (android.net.Uri)11 FileOutputStream (java.io.FileOutputStream)11 Bundle (android.os.Bundle)10