glodos
glodos

Reputation: 1233

Send intent to a media player app with an InputStream

After lots of searching I didn't find any answer how to solve the problem described in the title.

I want to send intent to the system in order to play some media. It can be everywhere, in an encrypted zip, on FTP server or on my PC via SMB access. I use input and output streams as a pipe between different protocols, so a file can be copied between them without any obstacles.

What i want to achieve is to give an access to this input stream for any streaming app available in the system. For example the streaming app can play a song located on my PC's SMB shares or directly from an encrypted zip without extracting/downloading it, only using the given input stream.

The only thing I have found so far is streaming from HTTP urls which is not my case. Does anyone know a possible solution for that?

Upvotes: 3

Views: 1695

Answers (1)

3c71
3c71

Reputation: 4511

Haven't tried yet, but I would assume you would have to provide the Uri of the file to be opened by the external app AND a provider matching this Uri.

eg if you have a smb://... Uri, then you need a provider installed to handle this.

Or it could be a custom Uri like mycustomprovider://, and the remaining of the Uri would be app-specific.

EDIT: What most file manager do is user a local HTTP connection. They open the stream and listen to a specific HTTP port to feed the stream into it.

EDIT2: Here is the solution using HTTP: Android ServerSocket programming with jCIFS streaming files

Though passing an InputStream would be so much easier ;) indeed!

Upvotes: 2

Related Questions