UNPKG

@aigamo/nostalgic-diva

Version:

React function components for imperatively controlling embedded players (audio, Niconico, SoundCloud and YouTube) using refs.

44 lines (43 loc) 1.08 kB
import t, { memo as n, useCallback as a } from "react"; import { L as u, S as d } from "./index-DzXJDFxB.js"; import { e as m } from "./ensureScriptLoaded-C7IsEn-U.js"; import { P as i } from "./PlayerContainer-BSDtKMGl.js"; const C = n(({ ...r }) => { const { logger: e } = r; e.log(u.Debug, "SoundCloudPlayer"); const l = a(async () => { await m( "https://w.soundcloud.com/player/api.js", e ); }, [e]), s = a( (o) => Promise.resolve(SC.Widget(o)), [] ); return /* @__PURE__ */ t.createElement( i, { ...r, loadScript: l, playerFactory: s, controllerFactory: d }, (o, c) => ( // eslint-disable-next-line jsx-a11y/iframe-has-title /* @__PURE__ */ t.createElement( "iframe", { ref: o, src: `https://w.soundcloud.com/player/?url=${c}`, frameBorder: 0, allow: "autoplay", style: { width: "100%", height: "100%" } } ) ) ); }); export { C as default }; //# sourceMappingURL=SoundCloudPlayer-ACbN5drz.js.map