AVRecorder.AddPreviewToWindow
-----------------------------

Adds a preview area to the window.

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

MBS( "AVRecorder.AddPreviewToWindow"; AVSession; WindowRef; X; Y; W; H ) 

**MBS**( **"AVRecorder.AddPreviewToWindow";** /\* Adds a preview area to the window. \*/  
**$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 \*/   
**$X**; /\* The x coordinate.e.g. 20 \*/   
**$Y**; /\* The y coordinatee.g. 200 \*/   
**$W**; /\* The width of the preview area.e.g. 320 \*/   
**$H**) /\* The height of the preview area.e.g. 200 \*/ 

### 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 |
| X | The x coordinate. | 20 |
| Y | The y coordinate | 200 |
| W | The width of the preview area. | 320 |
| H | The height of the preview area. | 200 |

### Result

Returns OK or error.

### Description

Adds a preview area to the window.  
### Examples

Start preview:

 Set Variable \[$r ; Value:MBS ("AVRecorder.AddPreviewToWindow"; $Session ; Get(WindowName); 50; 200; 320; 240)\]  
Set Variable \[$r ; Value:MBS ("[AVRecorder.StartPreview](AVRecorderStartPreview.md)"; $Session )\]  
### See also

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

### Release notes

- **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**
    - Rewrote parts of [AVRecorder.AddPreviewToWindow](https://www.mbsplugins.eu/AVRecorderAddPreviewToWindow.shtml) and [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) for Mac/iOS to work better. Positioning is now relative to top/left of FileMaker content.

### 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 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)
- [AVRecorder on iOS](https://www.mbsplugins.de/archive/2020-07-16/AVRecorder_on_iOS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr2](https://www.mbsplugins.de/archive/2020-06-08/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Audio and Video Recording for FileMaker](https://www.mbsplugins.de/archive/2016-02-21/Audio_and_Video_Recording_for_/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th February 2016 , last changed 4th August 2020

  
[AVPlayer.SetVolume](AVPlayerSetVolume.md) - [AVRecorder.AddPreviewWithControl](AVRecorderAddPreviewWithControl.md)

[HTML Version](AVRecorderAddPreviewToWindow.shtml)