Camera: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "file:camera.png == Description == The YouTube control lets you embed YouTube videos in your app. All the settings needed to display a video can be set at design time in ...")
 
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 3: Line 3:
== Description ==
== Description ==


The YouTube control lets you embed YouTube videos in your app. All the settings needed to display a video can be set at design time in AppStudio: no additional code needs to be written.
The Camera control lets you take pictures using your device's camera and display them in a PictureBox. The contents of that PictureBox can be saved in a database or sent to a server. All the settings needed to take a picture can be set at design time in AppStudio: no additional code needs to be written.


If you do want to change any settings at runtime, you can do so. Use the .refresh() method to redisplay the video with your new settings.
The default icon is a camera icon. You can change this to a different icon or text.


== Properties ==
The control requires iOS7.1 or later. For Android web apps, use Chrome 31 or greater. If you are using VoltBuilder, use the [https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/index.html cordova-plugin-camera] plugin.


{| class = "wikitable"
When saving to an SQL data base via a PHP script, the data can be corrupted. If you encodeURIComponent the Base64 string it is saved ok. As follows:
|-
<pre>
| videoID || YouTube Video ID
postData = postData & "&imgBase64=" & encodeURIComponent(PictureBox1.toDataURL())
|-
</pre>
| playlist || Comma separated list of video IDs to play.
 
|-
== Properties and Methods ==
| autoplay || Start playing right away?
 
|-
Standard [[properties and methods|properties]] are supported, plus:
| autohide || Autohide controls?
{| class="wikitable"
|-
| controls || Show player controls?
|-
| modestbranding || Show YouTube logo?
|-
| playsinline || Fullscreen playback on iOS?
|-
|-
| rel || Show related videos when done?
| icon || Icon to show from the Font Awesome set. Default is 'camera'. Examples: trash, check. http://fontawesome.io/icons/ Design Time.
|-
|-
| ratio || Aspect ratio: 16x9 or 4x3
| picturebox || The ID of the PictureBox control on the form to put the picture into. Design time.
|-
|-
| showinfo || Show info about the video?
| picturebox.toDataURL() || The picture, in Base64 format, in .png. Runtime.
|-
|-
| start || Second to start at
| value || The title of the button. Design time or runtime.
|-
| theme || Display theme: dark or light
|-
| width || Height is calculated from this value.
|}
|}


Line 44: Line 34:
== Example ==
== Example ==


This code lets the user enter a Video ID at runtime. It also resizes based on screen size.
No code needed - it just works!
<pre>
Sub Main()
  txtVideoID.text=YouTube1.settings.videoID
End Sub
 
Function btnRefresh_onclick()
  YouTube1.settings.videoID = txtVideoID.text
  YouTube1.settings.width = Form1.Width-20
  YouTube1.refresh()
End Function
</pre>


== Output ==
== Output ==

Latest revision as of 22:35, 12 November 2020

Description

The Camera control lets you take pictures using your device's camera and display them in a PictureBox. The contents of that PictureBox can be saved in a database or sent to a server. All the settings needed to take a picture can be set at design time in AppStudio: no additional code needs to be written.

The default icon is a camera icon. You can change this to a different icon or text.

The control requires iOS7.1 or later. For Android web apps, use Chrome 31 or greater. If you are using VoltBuilder, use the cordova-plugin-camera plugin.

When saving to an SQL data base via a PHP script, the data can be corrupted. If you encodeURIComponent the Base64 string it is saved ok. As follows:

 postData = postData & "&imgBase64=" & encodeURIComponent(PictureBox1.toDataURL())

Properties and Methods

Standard properties are supported, plus:

icon Icon to show from the Font Awesome set. Default is 'camera'. Examples: trash, check. http://fontawesome.io/icons/ Design Time.
picturebox The ID of the PictureBox control on the form to put the picture into. Design time.
picturebox.toDataURL() The picture, in Base64 format, in .png. Runtime.
value The title of the button. Design time or runtime.

Events

Events are handled by the control itself.

Example

No code needed - it just works!

Output

Related Items