i\'m using usb device connected to my android device
this device send me a buffer that contain video frame it dose that continuously .
when i receive the
I found jacks205 doesn't mention abstract method close() in Closeable. We also need to write the close(), or the compiling will report the following errors: YourMediaDataSource is not abstract and does not override abstract method close() in Closeable
I know this is awhile since the question was asked, but I am in the same situation where I have a video transport stream coming through a USB connection.
It looks like you need to create a data source that extends a MediaDataSource and provides the readAt()
and getSize()
methods.
My understanding is Android's MediaPlayer, when you supply a URL/URI as a data source (through setDataSource()
, handles all the networking to download the data or retrieve it from storage, and has its own MediaDataSource the player users.
My plan is to create a service that gets the transport stream from the USB device, and constantly update a custom MediaDataSource that I supply to the MediaPlayer.
Here is the only thing I could find on the subject, which was a test written for testing using a MediaDataSource with the MediaPlayer. They read a video from a file into a byte array, and then use that array for the readAt()
and getSize()
methods.
Only other resources I could find are people supplying strings to the MediaPlayer, but nothing that involves doing their own networking. Also, I'm curious how a constant stream of video is different that just a fixed sized video.
Edit: I wrote a blog post about MediaDataSource and how to get started with it. Here is the link.