[{"triggeredBy":"manual","rec...}, ...]
Note: You may use stagecast.se as host for development tests but please use our CDN host d5q8k8cx63nj4.cloudfront.net for production.
{"name": "my custom moment name", ...other data}
{"type": "start","triggeredBy": "manual","title": "Quiz","name": "quiz","message": "User defined message (configured in Stagecast web)","isInteractive": true,"isFeedContent": false,"id": "ABB5F8FC-F1E4-4F94-986A-72F7747797D8","icons": ["https://d2cb7i0wbc0znj.cloudfront.net/api/content/FAD2C4A1-BC4E-46AE-B2DD-F601F769EEBF"],"event": "5041ED9C-9B09-4F94-8A44-F9E84B26C814","duration": 5400000,"created": 1579196250809,"class": "3108B8FE-DF9A-4509-9CCB-E054F1485795"}
const ws = new WebSocket('wss://stagecast.se/api/events/youreventid/ws')ws.addEventListener('message', function (event) {console.log('moment notification received', JSON.parse(event.data))})
Note: There is no guarantee that the Stagecast websocket interface will be always up. We might restart it at any time and also take it down for longer maintenance windows or the connection could be disrupted because of network errors. Therefore, any service that relies on being connected to the websocket interface needs to handle disconnection and errors by trying to periodically reestablishing the connection when it fails.
Note: When you integrate Stagecast into your App WebView, make sure to enable the support for window opening (more on this topic here and here). In general, Moments provide fallbacks in case a link cannot be opened on the native browser, but still, we encourage to add the support to ensure the best user experience possible.
...whatever webview code there is
The eventId can be found in the web frontend on https://stagecast.se/login for your created event. Look in the URL path once you have navigated to your event - it is some uuid string such as F5D6E9D6-5F1E-4A43-8348-0DA8BBAA29AF
or similar - and replace :eventId
in the request above with the uuid string you find.
import UIKitimport WebKitclass ViewController: UIViewController {@IBOutlet weak var webView: WKWebView!override func viewDidLoad() {super.viewDidLoad()let myURL = URL(string:"https://stagecast.se/api/web/events/F5D6E9D6-5F1E-4A43-8348-0DA8BBAA29A/my-device-id")let myRequest = URLRequest(url: myURL!)webView.load(myRequest)}}
...whatever moment code there is...
import UIKitimport WebKitclass ViewController: UIViewController {@IBOutlet weak var webView: WKWebView!override func viewDidLoad() {super.viewDidLoad()let myURL = URL(string:"https://stagecast.se/api/web/moments/E5D6F9D6-5F2E-4A43-8348-0DA8BBAA29A/my-device-id")let myRequest = URLRequest(url: myURL!)webView.load(myRequest)}}
...whatever webview code there is
If you want to embed the Moments in your website. Just copy-paste the following code snippet where you want it to be displayed. You will have to replace the event code, with the one belonging to your event.
Depending on your implementation, you might have to edit the style
property.
<iframeid="stagecast-embed"allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; microphone; midi; vr"title="Stagecast Embedded"style="width:100vw; height: 100vh; margin: 0;"src="https://join.stagecast.se/?code=YOUR_EVENT_CODE"></iframe>
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Test Embed</title><style>* {box-sizing: border-box;}body {margin: 0;padding: 0;overflow: hidden;}</style></head><body><!-- The iframe is embedded in a page with a header --><header style="height: 100px; width: 100%"><h1 style="margin: 0;">This is the page header</h1></header><iframeid="stagecast-embed"allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; microphone; midi; vr"title="Stagecast Embedded"style="width:100vw; height: calc(100vh - 100px); margin: 0; padding: 0; border: none;"src="https://join.stagecast.se/?code=1021"></iframe></body></html>
Missing a feature? We are working hard to build the best possible product for you. Please let us know in case you are missing a feature and we will be quick to respond. Thank you for your help!