@aigamo/nostalgic-diva
Version:
React function components for imperatively controlling embedded players (audio, Niconico, SoundCloud and YouTube) using refs.
41 lines (40 loc) • 949 B
JavaScript
import o, { memo as s, useCallback as a } from "react";
import { L as n, T as m } from "./index-DzXJDFxB.js";
import { e as h } from "./ensureScriptLoaded-C7IsEn-U.js";
import { P as y } from "./PlayerContainer-BSDtKMGl.js";
const P = s(({ ...r }) => {
const { logger: e } = r;
e.log(n.Debug, "TwitchPlayer");
const l = a(async () => {
await h("https://embed.twitch.tv/embed/v1.js", e);
}, [e]), c = a(
async (t, i) => Promise.resolve(
new Twitch.Player(t, {
video: i,
width: "100%",
height: "100%"
})
),
[]
);
return /* @__PURE__ */ o.createElement(
y,
{
...r,
loadScript: l,
playerFactory: c,
controllerFactory: m
},
(t) => /* @__PURE__ */ o.createElement(
"div",
{
ref: t,
style: { width: "100%", height: "100%" }
}
)
);
});
export {
P as default
};
//# sourceMappingURL=TwitchPlayer-Bk0XakuU.js.map