iframe API Quick Start
tip
WIREWAX iframe API is designed for iframe embed solution.
WIREWAX JW plugin and BrightCove JS plugin are using JavaScript embed solution, currently are not supported by WIREWAX iframe API.
important
Breaking Change (Oct 26, 2020): WIREWAX has updated iframe API CDN for Player5, please reference to our CDN for an up-to-date version as below.
If you are using Player5(embed link is embedder.wirewax.com
), you could safely switch to the new CDN without change any code.
If you are using Player4(embed link is embed.wirewax.com
), please keep using the old CDN to avoid breaking changes.
note
No more new features will be added for Player4 iframe API.
#
OverviewThe Iframe API lets you control the iframe embed WIREWAX video player on your website using JavaScript.
Using the API's JavaScript functions, you can control video play, pause, seek, adjust volume, or retrieve information about the video play state. You can also add event listeners that will execute in response to certain WIREWAX video events, such as player state change, interaction state change. To showcase the usage, we created a Live Demo on CodeSandbox.
#
RequirementsThe user's browser must support the HTML 5 postMessage
feature. Most browsers support this feature, we recommend using the latest Chrome browser for development and test.
WIREWAX iframe API is designed and developed to pair with WIREWAX player iframe embed solution. Currently it doesn't support WIREWAX third party player plugins or third party player JS embed.
#
Installation- Insert plugin script to the HTML head of your site.
- Set an
id
to your WIREWAX iframe element. The default iswirewax-player
, you can change this by setting thewindow.wirewax.playerId
variable. An error will be thrown in the JavaScript Console if the iframe is not found.
tip
WIREWAX currently has two versions of player being used by clients:
- Player 4 (Old Player): embed src URL starts with
embed.wirewax.com
- Player 5 (New Player): embed src URL starts with
embedder.wirewax.com
Player 5 script is backwards compatible with Player 4 iframe API.
#
Methods#
wirewax.triggerEventtriggerEvent
functions allow you to control WIREWAX video playback and interactions.
Syntax:
Parameters:
eventName
: string, a full list of eventName interfaces can be found in API reference: Trigger events.data(optional)
: varies based on the event
Example:
tip
WIREWAX Player will only start accepting events once it is ready. You can check this by listening for the "PLAYER_READY" event.
#
wirewax.addEventListeneraddEventListener
functions allow you to listen for the WIREWAX player states change and interaction events, and add event handlers.
Syntax:
Parameters:
eventName
: string, a list of eventNames can be found in API reference: Listener events.callback
: function
Example:
#
wirewax.enableGyro (Player 4 only)To enable gyro for 360 videos you can call window.wirewax.enableGyro()
which will save you the work to listen to all the device events and call our triggers.
Syntax:
warning
This method is used for Player 4 customization projects only, and deprecated in Player 5.