B4A Library RSVideoRecord Library!!!

gaucho

New Member
Licensed User
Longtime User
Front Camera

I found this library to record videos excellent,
I need to use the front camera, it is possible?
I saw this code that can help

int cameraType = 1; // front
camera = Camera.open(cameraType);

m_recorder = new MediaRecorder();
m_recorder.setPreviewDisplay(m_BeMeSurface);
m_recorder.setCamera(camera);


Many Thanks
Gaucho
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
I get:

B4X:
** Activity (main) Resume **

** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Ready event fired, success = true
main_record_ready (java line: 388)
java.lang.NullPointerException
    at com.rootsoft.videorecord.VideoRecord.StartPreview(VideoRecord.java:115)
    at anywheresoftware.b4a.samples.camera.main._record_ready(main.java:388)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:155)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:151)
    at com.rootsoft.videorecord.VideoRecord$1.surfaceCreated(VideoRecord.java:81)
    at android.view.SurfaceView.updateWindow(SurfaceView.java:571)
    at android.view.SurfaceView.access$000(SurfaceView.java:86)
    at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:833)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1860)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
    at android.view.Choreographer.doFrame(Choreographer.java:532)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
    at android.os.Handler.handleCallback(Handler.java:730)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5103)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
It works on my Xperia Play (using the outer/back camera) but not my Nexus 7 which only has a front camera. Perhaps that's the issue? How would I switch to the back one, before record.StartPreview?
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I've redone the example with some more error handling, and made it so you can re-record after viewing the video, and delete the video when done.
I also merged the init and prepare stages, and added some state tracking (is it attached to a panel? is it recording? I'd also like to suggest these be added to the library itself, as well as letting us select which camera to use before the preview starts, it's not letting me set the value for it)
 

Attachments

  • Camera.zip
    2 KB · Views: 397

ribber

Member
Licensed User
Longtime User
Hi,

great libary. I saw that there is a special method called setOutputFile2. It seems that this method can stream the video via network to a target device. The documentation says that we should not use this method yet. Is there any progress?

I would like to record a video locally and stream a preview to a remote device. Or is there any other possibilty?

Thank you!
 

ribber

Member
Licensed User
Longtime User
@XverhelstX Could you please add an _preview(Data() As Byte) Event to your great libary (like Erel in the Camera lib) ? This should be triggered if the preview element changes during recording to access direct the data.

Thank you!
 

alfcen

Well-Known Member
Licensed User
Longtime User
@Xverhelst, Hi,

All works fine as long as I use 640 x 480 resolution on both phone and tablet.
Anyway, no problem, just a question: don't know what exactly your lib wraps,
but is there any means of overlaying text on the recorded video?

Thanks & Cheers
 

JTmartins

Active Member
Licensed User
Longtime User
Hello,

I've trying to use this very usefull library, but came across some problems.

First I' would like to convert all steps into one.

I've made some atempts, and they work perfectly all the time under debug mode but not in release mode. It's like it needed some pause between steps.

Actually, in the sample provided, if we go trough the steps very quickly the same error occurs.

So I've implemented a pause (not very good practise, I know, but I wanted to see)

The result is uncertain. Some times it works, some times it doesn't.

Can someone help me. I really need something like this, but steps have to be merged. One click to record, one click to stop, which I think is the logical way.

Thanks very much.

EDIT

In the phone I get an error on video start.
In the tablet I get Java.io.IOexception : Invalid Preview surface ****Solved

demo works ok on both
 
Last edited:

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Anyone get this to work on the front camera?

I tried changing some values on 'record.VideoSource = 1' but that seems to do nothing.

help...
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @XverhelstX, thank you for uploading this library.
Firstly I was wondering if you know of anyway that the recording can also record what's in a label that has been added to the Panel1 as a view? I already added a label with a timer before I saw @vb1992 overlay example. Both of which works in live view but neither encodes the respective overviews into the video, thus all that is played back is the raw video. In your original post you said 'Here is a new library where you can record videos using a panel'. I incorrectly presumed that any views added to the panel (Panel1) would also be recorded, but they are not.

Secondly your example crashed on Android 5.0 Lollipop when I click start but works perfect in KitKat

Thanks in advance...
 
Last edited:

TAK

Member
Licensed User
Longtime User
Hi, is it possible to record current time for example in the left corner?

thx
 

TAK

Member
Licensed User
Longtime User
Hello guys,
how can i turn around the panel? The "camera-view" is wrong. I neet to rotate the panel (90 degrees).
thx
 

TAK

Member
Licensed User
Longtime User
Hello guys,
i found the problem. This Camera only supports "SupportedOrientations: landscape". What i have to do to support all orientations?

thx
 

BarryW

Active Member
Licensed User
Longtime User

How to use this on front camera?
 

Mashiane

Expert
Licensed User
Longtime User

Hi, I have just used your code and I like it. How does one improve the quality of the video and is it not possible to just have the whole record process in a record/stop button process?
 

Mashiane

Expert
Licensed User
Longtime User

Hi, is it possible to have the video recording functionality based on 1 button click event to start and stop recording?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…