The code that you yourself write, will run faster if you write it in Ruby. If your code is just a bit of "glue" code, it will be of no practical consequence. If you write extensive code, it is better to do it in Ruby.
Thanks for your answer but, as I mentioned, I tried to call a simple camera API method in Ruby, which, according to you, should work, but it does not :
<li><%= 'Camera info : ' + Camera::get_camera_info('main') %></li>
And what is the reason of the "exception: cannot load such file -- camera" during build ? Did I forget to install something ?
Here is my gems list :
I use RVM with a Ruby 2.1.5 version and I have added "camera" in the Build.yml extensions.
You do not need to add camera in the build.yml extensions. The camera API is not an extension. There is no camera extension. That is why you get the error message. The file (extension) you tried to load is not there. It's not needed.
get_camera_info() does not return a string, and so you cannot use it as you have above. It returns a Ruby hash, which contains a number of bits of information.
This will give you a string with a printable version of the hash:
<li><%= 'Camera info : ' + Camera::get_camera_info('main').inspect %></li>
Thanks for your answer. I just tried what you mentionned and it works !
FYI, I added "camera" in the extensions because that's what the documentation was indicating (see Rhomobile | Camera API):
Enabling the Camera
To use the camera API, you need to enable the camera on the device. Do this by adding that capability to the build.yml file:
capabilities: - camera
I still have 2 questions though :
- I need to capture both videos and pictures using the embedded camera. As far as I understand the Camera class, it only allows to take a picture/snapshot but not a video one. Is this correct ?
- I found the "mediacapture" extension (see Rhomobile | Camera) but I cannot make it work (yet) (see my other post here : Is mediacapture extension working with Rhodes 5.0.25 free version ? and on top of that, it should only support picture capture and not video capture..
So, my question is : is it possible to do video capture with Rhodes 5.0.25 ? if so, which extension should I use ?
"capabilities" and "extensions" are not the same thing!
Capabilities just lists device features that your application uses. Extensions are code libraries, and may or may not implement some device feature.
The Camera class only deals with still pictures. You can get them from either the camera directly or from the stored camera roll.
I don't know any thing about mediacapture. I think the API documentation is pretty goofed-up for Camera. I know that the the old "2.2" API works, I think the most accurate documentation for current Camera use is in the RhoMobile Guide section on "Device Capabilities". There is a camera section there:
As well, if you click a link to the API in the list of APIs, it will take you to the old 2.2 docs, which, in my experience, is accurate for current Rhodes 5.0.25:
To be sure that you got to the right documentation, make sure that the API documentation has a yellow warning at the top saying that it is old 2.2 documentation.
I'm not sure how you even found the new documentation for code that hasn't yet been implemented. It should be reported as a documentation error. (I will do so.) Did you just see how the URL for the API documentation is formed, and then type-in "camera" yourself in the URL? I think when it was realized that the new Camera API was not ready for release, they must have kept the documentation, since it was already written, and just made sure (or TRIED to make sure) that there were no links leading to it...
For clarification, (or confusion, thanks to Forum formatting of URLs...) I'm referring to this. As far as I know, this is not yet actually implemented. IMO it should not be present in the documentation, but is:
(yea, it looks here on the forum just like the first link above, but it is not the same thing...)
I don't know anything about any plans for video capture in Rhodes, unless I missed something. (But I haven't been looking, LOL.) It's not something I've tried with Rhodes. But I know this: you can write your own native extension to do anything that the device is capable of.
It really is something probably best done in native code. (e.g. Objective-C, C, C++, Java, depending on device.) I'm just basing this on my own past experience with video capture. (I've written a capture driver for an accessory device for notebooks, and I've written software for video capture and analysis for sports - specifically, golf).
Specifically, what is it that you need to do with video? Just capture it? Capture and display while capturing? A native extension might do the job, or else a native UI extension, or both.
First of all, thanks for your complete and clear answer. I really appreciate !
Concerning the "capabilities" vs "extensions" comment, shame on me. I really am a Rhodes' rooky.
Concerning the mediacapture doc page, honnestly I don't remember how I ended on this page. I think I ggogled something like "picture capture rhodes" or something...
Concerning the camera capability (see, I learn fast ;-)), I tried the Camera::get_camera_info call on an iOs device and it is working alright. But when I tried it on two different android devices, it does not work correctly, ie it returns 320x240 pixels for both main and front camera although the main camera resolution is 8 M pixels and front camera is 5 M pixels...
Any idea about this problem ?
And finally, about the video capture : in fact, we are evaluating Rhodes for a cross platform appilcation we want to develop and we need, amongst other functions, to capture videos, ie capture/display in real time and on top of that have a videoconference function between two applications as well. For the videoconference function, I will try to integrate WebRTC into our Rhodes app...