@scarlett-player/embed 1.0.0 → 1.0.2

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.
@@ -277,6 +277,11 @@ function setupVideoEventHandlers(video, api) {
277
277
  api.setState("duration", video.duration);
278
278
  api.setState("mediaType", video.videoWidth > 0 ? "video" : "audio");
279
279
  });
280
+ addHandler("loadeddata", () => {
281
+ if (video.videoWidth > 0) {
282
+ api.setState("mediaType", "video");
283
+ }
284
+ });
280
285
  addHandler("error", () => {
281
286
  const error = video.error;
282
287
  if (error) {
@@ -1606,7 +1611,10 @@ function createPlaylistPlugin(config) {
1606
1611
  const mergedConfig = { ...DEFAULT_CONFIG$1, ...config };
1607
1612
  let api = null;
1608
1613
  let tracks = mergedConfig.tracks || [];
1609
- let currentIndex = -1;
1614
+ let currentIndex = mergedConfig.initialIndex ?? -1;
1615
+ if (currentIndex < -1 || currentIndex >= tracks.length) {
1616
+ currentIndex = -1;
1617
+ }
1610
1618
  let shuffle = mergedConfig.shuffle || false;
1611
1619
  let repeat = mergedConfig.repeat || "none";
1612
1620
  let shuffleOrder = [];