AVAsset.WaitForLoaded test
---------------------

Waits for file to be loaded.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [AVAsset](component_AVAsset.md) | [8.0](newinversion80.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "AVAsset.WaitForLoaded"; Asset ) 

**MBS**( **"AVAsset.WaitForLoaded";** /\* Waits for file to be loaded. \*/  
**$Asset**) /\* The reference number of the asset. Please use [AVAsset.OpenContainer](AVAssetOpenContainer.md), [AVAsset.OpenFile](AVAssetOpenFile.md) or [AVAsset.OpenURL](AVAssetOpenURL.md) function to get asset reference. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Asset | The reference number of the asset. Please use [AVAsset.OpenContainer](AVAssetOpenContainer.md), [AVAsset.OpenFile](AVAssetOpenFile.md) or [AVAsset.OpenURL](AVAssetOpenURL.md) function to get asset reference. | $asset |

### Result

Returns status or error.

### Description

Waits for file to be loaded.  
Returns status like Loading, Loaded, Cancelled, Failed or Unknown.  
If status starts with "Failed: ", it is followed by a reason.  
  
While [AVAsset.Loaded](AVAssetLoaded.md) returns directly and may return "Loading", this function can be called after [AVAsset.OpenFile](AVAssetOpenFile.md), [AVAsset.OpenURL](AVAssetOpenURL.md) or [AVAsset.OpenContainer](AVAssetOpenContainer.md) to have the script wait for assets to load.  
### Examples

Load asset:

 Set Variable \[ $path ; Value: "/Users/cs/Movies/video.mov" \]   
Set Variable \[ $asset ; Value: MBS ("[AVAsset.OpenFile](AVAssetOpenFile.md)"; $path ) \]   
\# now wait a few milliseconds to load   
Set Variable \[ $r1 ; Value: MBS ( "AVAsset.WaitForLoaded"; $asset ) \]   
\# check status   
Set Variable \[ $r2 ; Value: MBS ( "[AVAsset.Loaded](AVAssetLoaded.md)"; $asset ) \]   
Show Custom Dialog \[ "Loaded" ; $r1 &amp; ¶ &amp; $r2 \]   
Set Variable \[ $r3 ; Value: MBS ( "[AVAsset.Release](AVAssetRelease.md)"; $asset ) \]  
### See also

- [AVAsset.Loaded](AVAssetLoaded.md)
- [AVAsset.OpenContainer](AVAssetOpenContainer.md)
- [AVAsset.OpenFile](AVAssetOpenFile.md)
- [AVAsset.OpenURL](AVAssetOpenURL.md)
- [AVAsset.Release](AVAssetRelease.md)

### Release notes

- **Version 8.0**
    - Added [AVAsset.WaitForLoaded](http://www.mbsplugins.eu/AVAssetWaitForLoaded.shtml) function.

### Example Databases

- [Mac and iOS/AVExport](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/AVExport.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 8.0pr7](https://www.mbsplugins.de/archive/2018-01-10/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 9th January 2018 , last changed 9th January 2018

  
[AVAsset.URL](AVAssetURL.md) - [AVExport.AllExportPresets](AVExportAllExportPresets.md)

[HTML Version](AVAssetWaitForLoaded.shtml)