Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I read (I think it was even on stackoverflow) that you can provide the MediaRecorder with a FileHandle of a TCP-Connection. Then you can listen to that connection, read the data, packetize it and resend it as a RTSP/RTP-Stream.</p> <p>If I happen to find the original post, I'll reference it here.</p> <p><strong>EDIT:</strong></p> <p>The original Post was: <a href="https://stackoverflow.com/q/4155166/982149">Streaming Video From Android</a></p> <p>And the part about the Filedescriptor is from: <a href="http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system" rel="nofollow noreferrer">http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system</a></p> <p>Just in case, I cite the according example from the blog:</p> <pre><code>String hostname = "your.host.name"; int port = 1234; Socket socket = new Socket(InetAddress.getByName(hostname), port); ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket); MediaRecorder recorder = new MediaRecorder(); // Additional MediaRecorder setup (output format ... etc.) omitted recorder.setOutputFile(pfd.getFileDescriptor()); recorder.prepare(); recorder.start(); </code></pre> <p>However this only sends the Video File Data over the wire. You can save it and then play it back. But as mentioned, it is not a stream, yet.</p> <p><strong>UPDATE:</strong> You do not even have to use a TCP Socket for the first step. I just tripped over "LocalSocket"(1), that also gets you a FileHandle to feed the MediaRecorder. Those Local sockets are "AF_LOCAL/UNIX domain stream socket"s. See <a href="http://developer.android.com/reference/android/net/LocalSocket.html" rel="nofollow noreferrer">http://developer.android.com/reference/android/net/LocalSocket.html</a></p> <p>I have not tried all the above myself as of today, but will pretty soon. So maybe I can be of more help in the near future :)</p> <p>(1) <strong>LocalSocket</strong> is not usable on newer Android versions for security reasons! See Update from 2015-11-25.</p> <p><strong>UPDATE 2:</strong> Just saw in the Android Sources the "OUTPUT_FORMAT_RTP_AVP". But it is hidden :( So I guess it will be available in future API versions of Android. <a href="https://github.com/android/platform_frameworks_base/blob/master/media/java/android/media/MediaRecorder.java" rel="nofollow noreferrer">https://github.com/android/platform_frameworks_base/blob/master/media/java/android/media/MediaRecorder.java</a> Line 219:</p> <pre><code>public static final int OUTPUT_FORMAT_RTP_AVP = 7; </code></pre> <p><em>I have not tried just tricking the hide by providing a hardcoded <code>7</code> ... If anybody does, please leave a comment here!</em></p> <p><strong>UPDATE 2015-11-25</strong></p> <p>I just ran into libstreaming: <a href="https://github.com/fyhertz/libstreaming" rel="nofollow noreferrer">https://github.com/fyhertz/libstreaming</a> I did not look into it too deeply, but it seems there is a lot to be learned about streaming from Android from this project (if not only using it). I read there that the <strong>LocalSocket solution is invalid</strong> for newer Android versions :( But they present an alternative: ParcelFileDescriptor.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload