| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
AVPlayer.Play
Plays sound.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| AVPlayer | 7.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |
MBS( "AVPlayer.Play"; AVPlayer ) More
Parameters
| Parameter | Description | Example |
|---|---|---|
| AVPlayer | The reference number of the player. | $Player |
Result
Returns OK or error.
Description
Plays sound.For Windows use WMFP.Play instead.
Examples
Play audio:
If [$$Player ≠ ""]
Set Variable [$r; Value:MBS("AVPlayer.Play"; $$Player)]
Else
Show Custom Dialog ["Please open Movie first!"]
End If
Set Variable [$r; Value:MBS("AVPlayer.Play"; $$Player)]
Else
Show Custom Dialog ["Please open Movie first!"]
End If
Play with progress:
If [ $$Player ≠ "" ]
# set progress callback
Set Variable [ $r ; Value: MBS("AVPlayer.SetProgressEvaluate"; $$Player; "MBS(\"FM.ExecuteFileSQL\"; \"AVPlayer.fmp12\"; \"UPDATE \\\"AVPlayer\\\" SET \\\"Position\\\"=?\"; 9; 13; $$Time$$ / 1000)") ]
Set Variable [ $r ; Value: MBS("AVPlayer.SetProgressInterval"; $$Player; 1) ]
# now plays
Set Variable [ $r ; Value: MBS("AVPlayer.Play"; $$Player) ]
# commit. SQL can't update if record is edited.
Commit Records/Requests [ With dialog: Off ]
# Trigger script when sound is done.
Set Variable [ $r ; Value: MBS("AVPlayer.SetFinishedScript"; $$Player; Get(FileName); "Played") ]
Else
Show Custom Dialog [ "Please open Movie first!" ]
End If
# set progress callback
Set Variable [ $r ; Value: MBS("AVPlayer.SetProgressEvaluate"; $$Player; "MBS(\"FM.ExecuteFileSQL\"; \"AVPlayer.fmp12\"; \"UPDATE \\\"AVPlayer\\\" SET \\\"Position\\\"=?\"; 9; 13; $$Time$$ / 1000)") ]
Set Variable [ $r ; Value: MBS("AVPlayer.SetProgressInterval"; $$Player; 1) ]
# now plays
Set Variable [ $r ; Value: MBS("AVPlayer.Play"; $$Player) ]
# commit. SQL can't update if record is edited.
Commit Records/Requests [ With dialog: Off ]
# Trigger script when sound is done.
Set Variable [ $r ; Value: MBS("AVPlayer.SetFinishedScript"; $$Player; Get(FileName); "Played") ]
Else
Show Custom Dialog [ "Please open Movie first!" ]
End If
See also
- AVPlayer.GetRate
- AVPlayer.SetFinishedScript
- AVPlayer.SetProgressEvaluate
- AVPlayer.SetProgressInterval
- FM.ExecuteFileSQL
- WMFP.Play
Example Databases
This function checks for a license.
Created 3th February 2017, last changed 18th June 2022