Package org.robolectric.shadows
Class ShadowMediaMetadataRetriever
java.lang.Object
org.robolectric.shadows.ShadowMediaMetadataRetriever
@Implements(android.media.MediaMetadataRetriever.class) public class ShadowMediaMetadataRetriever extends Object
- 
Constructor SummaryConstructors Constructor Description ShadowMediaMetadataRetriever()
- 
Method SummaryModifier and Type Method Description static voidaddException(DataSource ds, RuntimeException e)Configures an exception to be thrown whensetDataSource(org.robolectric.shadows.util.DataSource)is called for the given data source.static voidaddFrame(Context context, Uri uri, long time, Bitmap bitmap)Adds the given bitmap at the given time for the given data source.static voidaddFrame(FileDescriptor fd, long offset, long length, long time, Bitmap bitmap)Adds the given bitmap at the given time for the given data source.static voidaddFrame(FileDescriptor fd, long time, Bitmap bitmap)Adds the given bitmap at the given time for the given data source.static voidaddFrame(String path, long time, Bitmap bitmap)Adds the given bitmap at the given time for the given data source.static voidaddFrame(String uri, Map<String,String> headers, long time, Bitmap bitmap)Adds the given bitmap at the given time for the given data source.static voidaddFrame(DataSource ds, long time, Bitmap bitmap)static voidaddMetadata(String path, int keyCode, String value)Adds the given keyCode/value pair for the given data source.static voidaddMetadata(DataSource ds, int keyCode, String value)static voidaddScaledFrame(DataSource ds, long time, int dstWidth, int dstHeight, Bitmap bitmap)protected StringextractMetadata(int keyCode)protected BitmapgetFrameAtTime(long timeUs, int option)protected BitmapgetScaledFrameAtTime(long timeUs, int option, int dstWidth, int dstHeight)static voidreset()protected voidsetDataSource(Context context, Uri uri)protected voidsetDataSource(MediaDataSource mediaDataSource)protected voidsetDataSource(FileDescriptor fd, long offset, long length)protected voidsetDataSource(String path)protected voidsetDataSource(String uri, Map<String,String> headers)voidsetDataSource(DataSource dataSource)
- 
Constructor Details- 
ShadowMediaMetadataRetrieverpublic ShadowMediaMetadataRetriever()
 
- 
- 
Method Details- 
setDataSource
- 
setDataSource
- 
setDataSource
- 
setDataSource
- 
setDataSource
- 
setDataSource
- 
extractMetadata
- 
getFrameAtTime
- 
getScaledFrameAtTime@Implementation(minSdk=27) protected Bitmap getScaledFrameAtTime(long timeUs, int option, int dstWidth, int dstHeight)
- 
addExceptionConfigures an exception to be thrown whensetDataSource(org.robolectric.shadows.util.DataSource)is called for the given data source.- Parameters:
- ds- the data source that will trigger an exception
- e- the exception to trigger, or null to avoid throwing an exception.
 
- 
addMetadata
- 
addMetadataAdds the given keyCode/value pair for the given data source. Usespathto callDataSource.toDataSource(String)and then callsaddMetadata(DataSource, int, String). This method is retained mostly for backwards compatibility; you can calladdMetadata(DataSource, int, String)directly.- Parameters:
- path- the path to the data source whose metadata is being set.
- keyCode- the keyCode for the metadata being set, as used by- MediaMetadataRetriever.extractMetadata(int).
- value- the value for the specified metadata.
 
- 
addFrame
- 
addScaledFramepublic static void addScaledFrame(DataSource ds, long time, int dstWidth, int dstHeight, Bitmap bitmap)
- 
addFrameAdds the given bitmap at the given time for the given data source. Usespathto callDataSource.toDataSource(String)and then callsaddFrame(DataSource, long, Bitmap). This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)directly.- Parameters:
- path- the path to the data source.
- time- the playback time at which the specified bitmap should be retrieved.
- bitmap- the bitmap to retrieve.
 
- 
addFrameAdds the given bitmap at the given time for the given data source. Usespathto callDataSource.toDataSource(Context, Uri)and then callsaddFrame(DataSource, long, Bitmap). This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)directly.- Parameters:
- context- the Context object to match on the data source.
- uri- the Uri of the data source.
- time- the playback time at which the specified bitmap should be retrieved.
- bitmap- the bitmap to retrieve.
 
- 
addFrameAdds the given bitmap at the given time for the given data source. Usespathto callDataSource.toDataSource(String, Map)and then callsaddFrame(DataSource, long, Bitmap). This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)directly.- Parameters:
- uri- the Uri of the data source.
- headers- the headers to use when requesting the specified uri.
- time- the playback time at which the specified bitmap should be retrieved.
- bitmap- the bitmap to retrieve.
 
- 
addFrameAdds the given bitmap at the given time for the given data source. Usespathto callDataSource.toDataSource(FileDescriptor)and then callsaddFrame(DataSource, long, Bitmap). This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)directly.- Parameters:
- fd- file descriptor of the data source.
- time- the playback time at which the specified bitmap should be retrieved.
- bitmap- the bitmap to retrieve.
 
- 
addFrameAdds the given bitmap at the given time for the given data source. Usespathto callDataSource.toDataSource(FileDescriptor, long, long)and then callsaddFrame(DataSource, long, Bitmap). This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)directly.- Parameters:
- fd- file descriptor of the data source.
- offset- the byte offset within the specified file from which to start reading the data.
- length- the number of bytes to read from the file.
- time- the playback time at which the specified bitmap should be retrieved.
- bitmap- the bitmap to retrieve.
 
- 
reset
 
-