AVRecorder.AddPreviewWithControl
--------------------------------

Adds a preview area to the window using placeholder control.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [AVRecorder](component_AVRecorder.md) | [10.3](newinversion103.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "AVRecorder.AddPreviewWithControl"; AVSession; WindowRef; ControlName ) 

**MBS**( **"AVRecorder.AddPreviewWithControl";** /\* Adds a preview area to the window using placeholder control. \*/  
**$AVSession**; /\* The ID for the AVRecorder session as returned by [AVRecorder.Init](AVRecorderInit.md). \*/   
**$WindowRef**; /\* Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window.e.g. 0 \*/   
**$ControlName**) /\* The name of the control on your FileMaker form.   
e.g. you can place a rectangle there to define the position.e.g. "mymedia" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| AVSession | The ID for the AVRecorder session as returned by [AVRecorder.Init](AVRecorderInit.md). | $AVSession |
| WindowRef | Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window. | 0 |
| ControlName | The name of the control on your FileMaker form.    e.g. you can place a rectangle there to define the position. | "mymedia" |

### Result

Returns OK or error.

### Description

Adds a preview area to the window using placeholder control.  
### Examples

Add preview to our layout:

 # go to the right layout   
Go to Layout \[ “Webcam” (LiveStream) ; Animation: None \]  
New Record/Request  
\# pause to actually show the new layout   
Pause/Resume Script \[ Duration (seconds): ,3 \]   
\# place preview on the control   
Set Variable \[ $r ; Value: MBS ( "AVRecorder.AddPreviewWithControl"; $$SessionID ; 0; "Preview" ) \]   
\# Start video stream   
Set Variable \[ $r ; Value: MBS ( "[AVRecorder.StartPreview](AVRecorderStartPreview.md)"; $$sessionID ) \]  
### See also

- [AVRecorder.Init](AVRecorderInit.md)
- [AVRecorder.StartPreview](AVRecorderStartPreview.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)

### Release notes

- **Version 14.4**
    - Fixed a problem with [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) positioning the layer for FileMaker 21.
- **Version 13.5**
    - Fixed a problem with [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) and [AVRecorder.StartRecording](https://www.mbsplugins.eu/AVRecorderStartRecording.shtml) functions when they returned OK instead of the error.
    - Fixed a problem with [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) picking wrong window if layout and window had same name.
- **Version 11.2**
    - Fixed problem on Windows with [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) and [AVRecorder.AddPreviewToWindow](https://www.mbsplugins.eu/AVRecorderAddPreviewToWindow.shtml) not using the FileMaker window, but a separate one.
- **Version 10.5**
    - Fixed crash with [AVRecorder.StartPreview](https://www.mbsplugins.eu/AVRecorderStartPreview.shtml), [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) and [AVRecorder.AddPreviewToWindow](https://www.mbsplugins.eu/AVRecorderAddPreviewToWindow.shtml) if you call those twice.
- **Version 10.3**
    - Added [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) function.
    - Added rotation parameter for [AVRecorder.AddPreviewWithControl](https://www.mbsplugins.eu/AVRecorderAddPreviewWithControl.shtml) function.

### Example Databases

- [AVRecorder/AVRecorder iOS Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/AVRecorder/AVRecorder%20iOS%20Test.shtml#9ScriptAnchor_)
- [AVRecorder/AVRecorder](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/AVRecorder/AVRecorder.shtml#9ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 22 - Taking Photos](https://www.mbsplugins.de/archive/2024-12-22/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.4pr1](https://www.mbsplugins.de/archive/2024-07-24/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.5pr6](https://www.mbsplugins.de/archive/2023-10-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.2pr7](https://www.mbsplugins.de/archive/2021-05-11/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.5pr6](https://www.mbsplugins.de/archive/2020-10-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [What is new in the MBS FileMaker Plugin Version 10.3](https://www.mbsplugins.de/archive/2020-07-31/What_is_new_in_the_MBS_FileMak/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr10](https://www.mbsplugins.de/archive/2020-07-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [AVRecorder on iOS](https://www.mbsplugins.de/archive/2020-07-16/AVRecorder_on_iOS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr3](https://www.mbsplugins.de/archive/2020-06-12/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 9th June 2020 , last changed 24th February 2022

  
[AVRecorder.AddPreviewToWindow](AVRecorderAddPreviewToWindow.md) - [AVRecorder.AudioDeviceCount](AVRecorderAudioDeviceCount.md)

[HTML Version](AVRecorderAddPreviewWithControl.shtml)