Search...
togglePlay( )
Toggles playback.
Description
The togglePlay()
function either pauses or plays the current video based
on its current state:
- If the video is paused, it plays and a
play
event is fired. Theplay
event handlers set on the video player by the onPlay( ) function or in the Editor are called. - If the video is playing, it is paused and a
pause
event is fired. Thepause
event handlers set on the video player by the onPause( ) function or in the Editor are called.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - When playback has been toggled.
Returns an empty object.
Status/Error Codes
Was this helpful?
Toggle playback
Copy Code
1$w("#myVideoPlayer").togglePlay();
Toggle playback and log a message when done
Copy Code
1$w("#myVideoPlayer").togglePlay()2 .then( () => {3 console.log("Done with toggle play");4 } );