Open b3nk4n opened 9 years ago
VideoStreamSenderActivity was implemented, which can be accessed via Settings -> Video Streaming
It shows a preview of the device camera.
A connection from a web-browser to the device could be established using that script:
<html>
<head>
<meta name='viewport' content='target-densitydpi=device-dpi,initial-scale=1,minimum-scale=1,user-scalable=yes'/>
</head>
<body>
<center>
<img src="http://192.168.178.53:6789/" alt="Stream" align="middle">
</center>
</body>
</html>
BUT: currently, we get a MediaRecorder can not start RuntimeException !?
Interresting links: StreamProxy: http://stackoverflow.com/questions/5343730/mediaplayer-stutters-at-start-of-mp3-playback/
Sender/Receiver via MediaRecoder/MediaPlayer: http://stackoverflow.com/questions/6116880/stream-live-video-from-phone-to-phone-using-socket-fd/ Keep in mind that MediaPlayer can not play data from a socked directly. Therefore, we have to buffer the data in a file or use the StreamProxy.
This user reports, that he gets the same error on his Samsung 4.0.4 device (like ours), but no error on another 4.2 device: http://stackoverflow.com/questions/16527009/mediarecorder-start-runtimeexception-start-failed-android-4-0-4
Very useful source: http://developer.android.com/guide/topics/media/camera.html
The camera API says: Note: Starting with Android 4.0 (API level 14), the Camera.lock() and Camera.unlock() calls are managed for you automatically.
But I can not confirm that, because it was not working on my 4.0.4 tablet without Camera.lock() or Camera.unlock() calls.
Maybe we can get some inspiration from here: https://code.google.com/p/ipcamera-for-android/source/browse/trunk/droidipcam/src/teaonly/projects/droidipcam/CameraView.java
They are doing basically the same thing as we do. Maybe this could help us to know how to handle errors with the Camera lifecycle...
VideoViews seem to have an easy method of streaming: setVideoURI()
https://developer.android.com/reference/android/widget/VideoView.html
Because it is hard to test with the IP-cam of ASEP, we will use a second android device as camera stream sender.