/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// eslint-disable-next-line import/no-unresolved
import { html } from "lit.all.mjs";
import "chrome://global/content/elements/moz-card.mjs";
import "./webrtc-preview.mjs";
window.MozXULElement.insertFTLIfNeeded("browser/webrtc-preview.ftl");
export default {
title: "Domain-specific UI Widgets/WebRTC/Preview",
component: "webrtc-preview",
argTypes: {
deviceId: {
control: "text",
},
mediaSource: {
control: "select",
options: ["camera", "screen", "window", "browser"],
},
showPreviewControlButtons: {
control: {
type: "boolean",
},
},
},
};
const Template = (args, context) => {
// Get deviceId from loaded data if available
const deviceId = context?.loaded?.deviceId || args.deviceId;
// If deviceId is not available show an error message.
if (!deviceId) {
return html`