Android Question Media Player - setDataSource (MediaDataSource dataSource)

shashkiranr

Active Member
Licensed User
Longtime User
Hi All,

I need to play an audio file from a byte array. I came across where you can set the data source of media player to be of type MediaDataSource.

As per the android developer - "For supplying media data to the framework. Implement this if your app has special requirements for the way media data is obtained"

I am getting the audio from an external source through the B4J webserver in a custom encoded format. I can decode the stream and want to use the bytes to play the audio without creating a temp audio file.

Is there any way to create a MediaDataSource so that I can use it with Media Player.?

Kindly let me know.

Links: https://developer.android.com/reference/android/media/MediaDataSource.html

Best,
SK
 

shashkiranr

Active Member
Licensed User
Longtime User
Hi Erel,

Is it possible to create the datatype using Javaobject or reflection or Inline java?

Best,
Shashi Kiran
 
Upvote 0

shashkiranr

Active Member
Licensed User
Longtime User
Hi Steve,

I have to custom seekbar for which I need to set the secondary progress of the audio file that I am playing and it is not easy to implement with audiotrack or I still have to figure out how to do it and modify it for my current implementation and I am looking into it.

@Erel Is there any possibility MediaDataSource will be added in the future for the library?

Best,
SK
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If your passing data from an array, you already know the position and don't need either library to return it.
 
Upvote 0
Top