How to use ExoPlayer to play video data from LocalSocket?

33 views Asked by At

My scenario is like this: I have a LocalSocket, and the data of this LocalSocket is an uninterrupted data stream similar to live broadcast. And I need to use ExoPlayer to play this video stream.

I hava a dataSource, a LocalSocket:

val localSocket = LocalSocket()
localSocket.connect(LocalSocketAddress("this.is.my.address"), LocalSocketAddress.Namespace.ABSTRACT)
// maybe can use this inputStream
val inputStream = localSocket.inputStream

I know that using ExoPlayer requires a DataSource and a MediaSource. But I looked at some related inner classes like ByteArrayDataSource/BaseDataSource/UdpDataSource/DefaultHttpDataSource. But there is no class called InputStreamDataSource, and MadiaSource can't find any related class that can realize the above operations.

Also, create a custom MediaSource is hard to do for me..because I see lot's of constractors needs a param who named Uri...My data is LocalSocket'inputStream, I don't have a Uri....

How shold I do...Can anynoe helps me?

0

There are 0 answers