Search in sources :

Example 1 with AssetFileDescriptor

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

the class MediaPlayerWrapperPauseTest method testPauseStopped.

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

Example 2 with AssetFileDescriptor

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

the class MediaPlayerWrapperPauseTest method testPauseInitialized.

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

Example 3 with AssetFileDescriptor

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

the class MediaPlayerWrapperPrepareTest method testPrepareStopped.

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

Example 4 with AssetFileDescriptor

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

the class MediaPlayerWrapperStopTest method testStopPaused.

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

Example 5 with AssetFileDescriptor

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

the class MediaPlayerWrapperPrepareTest method testPrepareInitialized.

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

Aggregations

AssetFileDescriptor (android.content.res.AssetFileDescriptor)260 IOException (java.io.IOException)147 ParcelFileDescriptor (android.os.ParcelFileDescriptor)57 FileNotFoundException (java.io.FileNotFoundException)56 MediaPlayer (android.media.MediaPlayer)44 ContentResolver (android.content.ContentResolver)36 Test (org.junit.Test)31 FileInputStream (java.io.FileInputStream)29 Uri (android.net.Uri)28 InputStream (java.io.InputStream)23 RemoteException (android.os.RemoteException)22 File (java.io.File)21 Bundle (android.os.Bundle)16 FileDescriptor (java.io.FileDescriptor)16 Nullable (android.annotation.Nullable)15 Bitmap (android.graphics.Bitmap)15 Parcel (android.os.Parcel)14 Resources (android.content.res.Resources)13 BitmapFactory (android.graphics.BitmapFactory)13 DeadObjectException (android.os.DeadObjectException)12