Skip to main content

init()

info

init() method must be called. The iFrame is not mounted until the init method is called.

The init method must be called to initialize or mount the Metered Embed. You can call the init method as soon as the page loading is complete or you can call the init method after some user interaction, if you want the Embed to appear based on user action.

The init method takes two argument, one is the options and seconds in the dom element.

var frame = new MeteredFrame(); 
frame.init({
roomURL: "appname.metered.live/my-room",
}, document.getElementById("metered-frame"));

Here is the complete list of options avaliable:

OptionRequiredDescriptionDefault Value
roomURLYESURL of the Meeting Room
widthNOSpecify the width of the embed100%
heightNOSpecify the height of the embed600px
autoJoinNOWhen autoJoin is true then users will not be presented with a Join Meeting/Lobby page and will be automatically join into the meeting. This property can also be set in the room settings, and whatever pass here will override the room settings.false or whatever set in the Room Settings.
nameNOName of the user. Used with autoJoin. Specify the name of the user and set autoJoin to true to automatically join the user with the specified name
accessTokenNOUsed with autoJoin. Specify the accessToken and set autoJoin to true to automatically join.
joinVideoOnNOCan also be set in the room settings. Whatever specified here will overried the room settingstrue or whatever set in the Room Settings
joinAudioOnNoCan also be set in the room settings. Whatever specified here will overried the room settingstrue or whatever set in the Room Settings
showInviteBoxNoWhen there is only one participant in the meeting, an invite box is shown with insturctions to invite other users. If this is set to false the invite box is hiddentrue or whatever set in the Room Settings
disableScreenSharingNoIf screen-sharing is enabled in the room settings, then using this parameter you can disable the screen-sharing for one embed or a particular set of users. It can only be used to disable screen-sharing. If screen-sharing is disabled in the room setting this property cannot be used to enable screen-sharing.false
disableChatNoIf chat is enabled in the room settings, then this setting can be used to disable chat in the specific embed where this parameter is passed.false

With the init options you can control the behavior of the embed, for e.g if you want to autoJoin the users on some pages of your application or support you want to build a livestreaming application and want to disable audio/video and chat until the user logged-in but still want to give the user ability to view the livestream, so you can do all this by passing appropriate parameters to the init method.