sa2kit 1.0.3 → 1.0.4

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.
package/dist/mmd/index.js CHANGED
@@ -1206,8 +1206,35 @@ var MMDPlaylist = ({
1206
1206
  return /* @__PURE__ */ React2__default.default.createElement("div", { className: "flex h-full w-full items-center justify-center bg-black text-white" }, /* @__PURE__ */ React2__default.default.createElement("p", null, "\u64AD\u653E\u5217\u8868\u8282\u70B9\u7D22\u5F15\u65E0\u6548"));
1207
1207
  }
1208
1208
  console.log("\u{1F3AF} [MMDPlaylist] \u5F53\u524D\u8282\u70B9:", currentNode.name, "\u7D22\u5F15:", currentNodeIndex);
1209
+ const stopNode = (nodeIndex) => {
1210
+ const playerElement = playerRefsMap.current.get(nodeIndex);
1211
+ if (!playerElement) return;
1212
+ console.log(`\u23F9\uFE0F [MMDPlaylist] \u505C\u6B62\u8282\u70B9 ${nodeIndex}`);
1213
+ const audioElement = playerElement.querySelector("audio");
1214
+ if (audioElement) {
1215
+ audioElement.pause();
1216
+ audioElement.currentTime = 0;
1217
+ console.log(` \u{1F507} \u505C\u6B62\u97F3\u9891`);
1218
+ }
1219
+ const stopButton = playerElement.querySelector('button[title="\u505C\u6B62"]');
1220
+ if (stopButton) {
1221
+ stopButton.click();
1222
+ console.log(` \u23F9\uFE0F \u70B9\u51FB\u505C\u6B62\u6309\u94AE`);
1223
+ } else {
1224
+ const pauseButton = playerElement.querySelector('button[title="\u6682\u505C"]');
1225
+ if (pauseButton) {
1226
+ pauseButton.click();
1227
+ console.log(` \u23F8\uFE0F \u70B9\u51FB\u6682\u505C\u6309\u94AE`);
1228
+ }
1229
+ }
1230
+ };
1209
1231
  React2.useEffect(() => {
1210
1232
  console.log(`\u{1F504} [MMDPlaylist] \u8282\u70B9\u5207\u6362: ${currentNodeIndex} - ${currentNode.name}`);
1233
+ editableNodes.forEach((_, index) => {
1234
+ if (index !== currentNodeIndex) {
1235
+ stopNode(index);
1236
+ }
1237
+ });
1211
1238
  onNodeChange?.(currentNodeIndex, currentNode);
1212
1239
  if (!isPreloading && (isAutoSwitchRef.current || playlist.autoPlay)) {
1213
1240
  console.log(`\u25B6\uFE0F [MMDPlaylist] \u51C6\u5907\u64AD\u653E\u8282\u70B9 ${currentNodeIndex}`);
@@ -1230,7 +1257,7 @@ var MMDPlaylist = ({
1230
1257
  }
1231
1258
  });
1232
1259
  }
1233
- }, [currentNodeIndex, currentNode, onNodeChange, isPreloading, playlist.autoPlay, preloadedNodes]);
1260
+ }, [currentNodeIndex, currentNode, onNodeChange, isPreloading, playlist.autoPlay, preloadedNodes, editableNodes]);
1234
1261
  const handleNodePreloaded = (nodeIndex) => {
1235
1262
  console.log(`\u2705 [MMDPlaylist] \u8282\u70B9 ${nodeIndex} \u9884\u52A0\u8F7D\u5B8C\u6210`);
1236
1263
  setPreloadedNodes((prev) => {