Use mediaprojection as a videosource for libstreaming - java

I'm new in android developing and i want to develop an app about (android) screen sharing to multiple android device in a local network. I want to send the output of mediaprojection in real time using libstreaming library. Is it possible? How can i replace the video source of libstreaming with the mediaprojection output?

Inside the VideoStream.java file wherein the source of the media recording is set to Camera, go ahead and change it to Surface.
MediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE)
This is assuming you want the screen recording to be streamed live to another screen.

Related

How to Record Current Screen In Android, Not using Camera

I want to implement a function that simply records what is currently being viewed on my phone, rather than using the camera.
But most of the samples use MediaRecorder and camera in parallel, I don't think this is what I need at the moment.
I've seen the MediaProjection API, but it runs in an Activity . I want to implement a screen recording function for a live streaming app I am currently developing. And this should work inside a Service.
Can someone give me some help?

Can you write an app that records the screen of a specific app in Android Java?

I'm try to make an android app that records specify app's screen and audio.
How can I record the screen?
Here's an example for using MediaProjection API for screen recording on Android: GoogleSource You can add Service class to run in a background check when a certain app package is opened. Here's an example to check an app running on Android. Stackoverflow Example

Read current audio output - Android

I want to know if it is possible to access the audio that is currently playing on the Android device.
Example: if Spotify is running in the background, I want to access the audio to control some LEDs that are connected to my RaspberryPi.
I want to create some sort of equalizer that changes colors depending on the sound that is currently playing. I appreciate if some one could tell me if accessing the main audio output is possible or not.
Unless you are using a rooted phone, it's not possible to capture output of a random app on Android.
You can however create an app that plays media files and captures the output for the purpose of visualization with "Visualizer" effect. You can take a look on the sample here: https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/src/com/example/android/apis/media/AudioFxDemo.java
(look for "Visualizer").
If you are using Raspberry Pi anyway, you can just play all your music through it, capture and analyze it there. You will need an external USB sound card though. See for example this post: http://www.g7smy.co.uk/2013/08/recording-sound-on-the-raspberry-pi/
There they just record and play audio back, but you can insert an analysis phase in between.

Speechrecognition while filming with camera

I'm developing an android app that needs to film and use speechrecognition at the same time. The problem is, that the camera uses the microphone so the speechrecognition api wont have acces to the microphone.
My solution was to disable the audio in the camera and only record the video. Problem with this solution is that when using the RecognitionListener you can't acces the audio file.
Then i tried to use the RecognizerIntent with startActivityForResult. The problem with this solution is that the activity will open a 'pop up' and the camera stops working. Does anyone have an idea how to fix this problem.
When you record video. did you receive any callback for what is recording? I mean if you can receive audio, you can save that audio alone, and then access it by recognizer

Capture android screen and create video programmatically

In Android/Java, Is there any code example to capture the screenshot of a computer with good frames per second programatically and create video?
I'd like a tutorial or full source code to do this. I'd like the program to work with and without the device having been "rooted".
There is app in the play store called Screencast Video Recorder that does this. But you need to ROOT the device for it to work, so I know it can be done.
What's the best way to capture android screenshot and create a video programmatically on a non-rooted device?
There is an app called Telecine that is open source that allows you to record screens - the code can be found at https://github.com/JakeWharton/Telecine. All credit is to Jake Wharton.
If you need an example, you can find one at Commonsware's github page - Mark Murphy has provided a sample app for both screen capture and screen recording using the MediaProjection APIs.
you can capture the screen via using DDMS as adb runs and has permission to the framebuffer:
follow this link for more details :
http://thetechjournal.com/electronics/android/how-to-capture-screenshots-and-record-video-on-android-device.xhtml
ALSO
check this links may be get some ideas about what you need :
http://answers.oreilly.com/topic/951-how-to-capture-video-of-the-screen-on-android/
http://www.mightypocket.com/2010/09/installing-android-screenshots-screen-capture-screen-cast-for-windows/
and check this project :
http://sourceforge.net/projects/ashot/
hope this help .
Check the following link
https://code.google.com/p/java-remote-control/
in this project the owner has created a java remote control i.e. he has captured the images from the remote computer and transfer to server and convert it to movies with different format all you need to understand what he has done and implement the same for all your needs. you can access the full source code with SVN client from the following URL
http://java-remote-control.googlecode.com/svn/trunk/
Also you can look for the Remote class in java which provides createScreenCapture method
As of Android 4.4, there is a screen recording feature accessible via adb.
http://developer.android.com/tools/help/adb.html#screenrecord
The screenrecord command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file, which you can then download and use as part of a video presentation. This utility is useful for developers who want to create promotional or training videos without using a separate recording device.
Try this application from the market
https://play.google.com/store/apps/details?id=com.ms.screencastfree
** Does not work on Galaxy Nexus or Tegra 2/3 yet **
EDIT 28/11/2014
Lollipop has been released and provides a new Screen recording API
http://developer.android.com/about/versions/android-5.0.html#UI
Screen capturing and sharing
Android 5.0 lets you add screen capturing and screen sharing
capabilities to your app with the new android.media.projection APIs.
This functionality is useful, for example, if you want to enable
screen sharing in a video conferencing app.
The new createVirtualDisplay() method allows your app to capture the
contents of the main screen (the default display) into a Surface
object, which your app can then send across the network. The API only
allows capturing non-secure screen content, and not system audio. To
begin screen capturing, your app must first request the user’s
permission by launching a screen capture dialog using an Intent
obtained through the createScreenCaptureIntent() method.
For an example of how to use the new APIs, see the MediaProjectionDemo
class in the sample project.

Categories