Streams JS SDK
You can use Streams JS SDK to send messages from the client side to your application.
Embed the script code between the <head> </head>
tags inside the page you embedded your Streams Link via iframe.
Despite you added the JS SDK script between the tags in your client code, if you can not establish a connection, please be sure that you copied the iFrame tag from the Vagon Streams dashboard.
If you manually created your iFrame code by adding your Streams Link, please check that you applied the id tag and other required iFrame properties correctly from the sample code below.
Then you will be able to use the JS methods to create your custom user experience for your application Stream.
Demo HTML
Functions
isConnected
Connection status, returns boolean.
sendApplicationMessage
Sends the related message to your application.
resizeFrame
Updates the streaming resolution and matches the iframe height and width when initiated.
focusIframe
Keeps the browser window focused on the streaming iframe. In case you are facing issues with keyboard inputs, you can use this method.
showKeyboard
If your visitors are using your Applications on mobile/tablet devices, you can also allow them to type with the on-screen keyboard inside Vagon Streams.
hideKeyboard
When the focus changes from the text input, you can hide the on-screen keyboard button from the screen as well.
enableGameMode
Activates 360 View cursor mode inside an active Stream.
disableGameMode
Disable 360 View cursor mode inside an active Stream.
keepAlive
Reset Idle Timer by sending a simulated user input when the Idle Duration Limit is active.
shutdown
Shut down the Stream Machine and terminate the related session immediately.
setQuality
Quality parameters can be set as "standard", "moderate" or "high". Session will be refreshed automatically after the quality is set.
getSessionInformation
Triggers the onSessionInformation
event, data must be collected via onSessionInformation
event.
Events
All events except onApplicationMessage is only available in Enterprise Plan.
onApplicationMessage
Prints out the message sent from the application, for application-side integration please check Unreal Engine and Unity SDKs.
onPointerLockChange
Prints out the message when the pointer lock (360 View Mode) state changes.
onInitialization
Prints out the message during the Stream initialization process.
onPreparingAssets
Prints out the message during the pixel streaming asset preparation process. Only available in Pixel Streaming enabled Streams.
onInstalling
Prints out the message when application is on installing state.
onConnected
Prints out the message when user is connected.
onDisconnected
Prints out the message when user is disconnected.
onInactive
Prints out the message when user is inactive. Only available when Idle Duration Limit is active.
onInstallationFailed
Prints out the message when app installation is failed.
onFailed
Prints out the message when connection is failed.
onSessionInformation
Prints out the message when connection is failed.
Sample Session Data
Last updated