@scarlett-player/embed 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2895,7 +2895,7 @@ function createValidatingPlaylistLoader(Hls) {
2895
2895
  }
2896
2896
  };
2897
2897
  }
2898
- var PKG_VERSION$5 = "1.7.1";
2898
+ var PKG_VERSION$5 = "1.8.1";
2899
2899
  var DEFAULT_CONFIG$3 = {
2900
2900
  debug: false,
2901
2901
  autoStartLoad: true,
@@ -3859,7 +3859,7 @@ function createHLSPlugin(config) {
3859
3859
  config
3860
3860
  );
3861
3861
  }
3862
- var PKG_VERSION$4 = "1.7.1";
3862
+ var PKG_VERSION$4 = "1.8.1";
3863
3863
  var VIDEO_EXTENSIONS = ["mp4", "webm", "mov", "mkv", "ogv", "m4v"];
3864
3864
  var AUDIO_EXTENSIONS = ["mp3", "wav", "ogg", "flac", "aac", "m4a", "opus", "weba"];
3865
3865
  var SUPPORTED_EXTENSIONS = [...VIDEO_EXTENSIONS, ...AUDIO_EXTENSIONS];
@@ -4238,7 +4238,7 @@ function createNativePlugin(config) {
4238
4238
  };
4239
4239
  return plugin;
4240
4240
  }
4241
- var PKG_VERSION$3 = "1.7.1";
4241
+ var PKG_VERSION$3 = "1.8.1";
4242
4242
  var DEFAULT_THEME = {
4243
4243
  primary: "#6366f1",
4244
4244
  background: "#18181b",
@@ -5237,7 +5237,7 @@ function injectStyles() {
5237
5237
  document.head.appendChild(el);
5238
5238
  return el;
5239
5239
  }
5240
- var PKG_VERSION$2 = "1.7.1";
5240
+ var PKG_VERSION$2 = "1.8.1";
5241
5241
  var DEFAULT_CONFIG$1 = {
5242
5242
  autoAdvance: true,
5243
5243
  preloadNext: true,
@@ -5652,7 +5652,7 @@ function createPlaylistPlugin(config) {
5652
5652
  };
5653
5653
  return plugin;
5654
5654
  }
5655
- var PKG_VERSION$1 = "1.7.1";
5655
+ var PKG_VERSION$1 = "1.8.1";
5656
5656
  var DEFAULT_CONFIG = {
5657
5657
  enablePlayPause: true,
5658
5658
  enableSeek: true,
@@ -5976,6 +5976,14 @@ function parseDataAttributes(element) {
5976
5976
  if (album) {
5977
5977
  config.album = album;
5978
5978
  }
5979
+ const shareUrl = getAttr(element, "data-share-url", "share-url");
5980
+ if (shareUrl) {
5981
+ config.shareUrl = shareUrl;
5982
+ }
5983
+ const embedBaseUrl = getAttr(element, "data-embed-base-url", "embed-base-url");
5984
+ if (embedBaseUrl) {
5985
+ config.embedBaseUrl = embedBaseUrl;
5986
+ }
5979
5987
  const brandColor = getAttr(element, "data-brand-color", "data-color", "color");
5980
5988
  if (brandColor) {
5981
5989
  config.brandColor = brandColor;
@@ -6078,6 +6086,23 @@ function applyContainerStyles(container, config) {
6078
6086
  container.style.width = container.style.width || "100%";
6079
6087
  }
6080
6088
  }
6089
+ const SHARE_CONTROL_LAYOUT = [
6090
+ "play",
6091
+ "skip-backward",
6092
+ "skip-forward",
6093
+ "volume",
6094
+ "time",
6095
+ "live-indicator",
6096
+ "bandwidth-indicator",
6097
+ "spacer",
6098
+ "share",
6099
+ "settings",
6100
+ "captions",
6101
+ "chromecast",
6102
+ "airplay",
6103
+ "pip",
6104
+ "fullscreen"
6105
+ ];
6081
6106
  async function createEmbedPlayer(container, config, pluginCreators2, availableTypes) {
6082
6107
  const type = config.type || "video";
6083
6108
  if (!availableTypes.includes(type)) {
@@ -6129,6 +6154,13 @@ async function createEmbedPlayer(container, config, pluginCreators2, availableTy
6129
6154
  if (type === "video" && pluginCreators2.gestures && config.gestures !== false) {
6130
6155
  plugins.push(pluginCreators2.gestures({}));
6131
6156
  }
6157
+ const shareEnabled = type === "video" && Boolean(config.shareUrl) && config.controls !== false;
6158
+ if (shareEnabled && pluginCreators2.share) {
6159
+ const shareConfig = { url: config.shareUrl };
6160
+ if (config.title) shareConfig.title = config.title;
6161
+ if (config.embedBaseUrl) shareConfig.embedBaseUrl = config.embedBaseUrl;
6162
+ plugins.push(pluginCreators2.share(shareConfig));
6163
+ }
6132
6164
  if (pluginCreators2.analytics && config.analytics?.beaconUrl) {
6133
6165
  plugins.push(pluginCreators2.analytics({
6134
6166
  beaconUrl: config.analytics.beaconUrl,
@@ -6142,6 +6174,7 @@ async function createEmbedPlayer(container, config, pluginCreators2, availableTy
6142
6174
  if (Object.keys(theme).length > 0) uiConfig.theme = theme;
6143
6175
  if (config.hideDelay !== void 0) uiConfig.hideDelay = config.hideDelay;
6144
6176
  if (config.bigPlayButton !== void 0) uiConfig.bigPlayButton = config.bigPlayButton;
6177
+ if (shareEnabled && pluginCreators2.share) uiConfig.controls = SHARE_CONTROL_LAYOUT;
6145
6178
  plugins.push(pluginCreators2.videoUI(uiConfig));
6146
6179
  } else if ((type === "audio" || type === "audio-mini") && pluginCreators2.audioUI) {
6147
6180
  plugins.push(pluginCreators2.audioUI({
@@ -6247,7 +6280,7 @@ function setupAutoInit(pluginCreators2, availableTypes) {
6247
6280
  }
6248
6281
  }
6249
6282
  }
6250
- const PKG_VERSION = "1.7.1";
6283
+ const PKG_VERSION = "1.8.1";
6251
6284
  const VERSION = `${PKG_VERSION}-audio`;
6252
6285
  const AVAILABLE_TYPES = ["audio", "audio-mini"];
6253
6286
  const pluginCreators = {
@@ -6258,6 +6291,9 @@ const pluginCreators = {
6258
6291
  mediaSession: createMediaSessionPlugin
6259
6292
  // Video UI not available in this build
6260
6293
  // Analytics not available in this build
6294
+ // Share not available in this build: the share button is a registered
6295
+ // control in @scarlett-player/ui, and the audio UIs render a fixed template
6296
+ // with no control registry, so there is nowhere to put it.
6261
6297
  };
6262
6298
  const ScarlettPlayerAPI = createScarlettPlayerAPI(
6263
6299
  pluginCreators,