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 +28 -1
- package/dist/mmd/index.js.map +1 -1
- package/dist/mmd/index.mjs +28 -1
- package/dist/mmd/index.mjs.map +1 -1
- package/package.json +20 -18
package/dist/mmd/index.mjs
CHANGED
|
@@ -1181,8 +1181,35 @@ var MMDPlaylist = ({
|
|
|
1181
1181
|
return /* @__PURE__ */ React2.createElement("div", { className: "flex h-full w-full items-center justify-center bg-black text-white" }, /* @__PURE__ */ React2.createElement("p", null, "\u64AD\u653E\u5217\u8868\u8282\u70B9\u7D22\u5F15\u65E0\u6548"));
|
|
1182
1182
|
}
|
|
1183
1183
|
console.log("\u{1F3AF} [MMDPlaylist] \u5F53\u524D\u8282\u70B9:", currentNode.name, "\u7D22\u5F15:", currentNodeIndex);
|
|
1184
|
+
const stopNode = (nodeIndex) => {
|
|
1185
|
+
const playerElement = playerRefsMap.current.get(nodeIndex);
|
|
1186
|
+
if (!playerElement) return;
|
|
1187
|
+
console.log(`\u23F9\uFE0F [MMDPlaylist] \u505C\u6B62\u8282\u70B9 ${nodeIndex}`);
|
|
1188
|
+
const audioElement = playerElement.querySelector("audio");
|
|
1189
|
+
if (audioElement) {
|
|
1190
|
+
audioElement.pause();
|
|
1191
|
+
audioElement.currentTime = 0;
|
|
1192
|
+
console.log(` \u{1F507} \u505C\u6B62\u97F3\u9891`);
|
|
1193
|
+
}
|
|
1194
|
+
const stopButton = playerElement.querySelector('button[title="\u505C\u6B62"]');
|
|
1195
|
+
if (stopButton) {
|
|
1196
|
+
stopButton.click();
|
|
1197
|
+
console.log(` \u23F9\uFE0F \u70B9\u51FB\u505C\u6B62\u6309\u94AE`);
|
|
1198
|
+
} else {
|
|
1199
|
+
const pauseButton = playerElement.querySelector('button[title="\u6682\u505C"]');
|
|
1200
|
+
if (pauseButton) {
|
|
1201
|
+
pauseButton.click();
|
|
1202
|
+
console.log(` \u23F8\uFE0F \u70B9\u51FB\u6682\u505C\u6309\u94AE`);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1184
1206
|
useEffect(() => {
|
|
1185
1207
|
console.log(`\u{1F504} [MMDPlaylist] \u8282\u70B9\u5207\u6362: ${currentNodeIndex} - ${currentNode.name}`);
|
|
1208
|
+
editableNodes.forEach((_, index) => {
|
|
1209
|
+
if (index !== currentNodeIndex) {
|
|
1210
|
+
stopNode(index);
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1186
1213
|
onNodeChange?.(currentNodeIndex, currentNode);
|
|
1187
1214
|
if (!isPreloading && (isAutoSwitchRef.current || playlist.autoPlay)) {
|
|
1188
1215
|
console.log(`\u25B6\uFE0F [MMDPlaylist] \u51C6\u5907\u64AD\u653E\u8282\u70B9 ${currentNodeIndex}`);
|
|
@@ -1205,7 +1232,7 @@ var MMDPlaylist = ({
|
|
|
1205
1232
|
}
|
|
1206
1233
|
});
|
|
1207
1234
|
}
|
|
1208
|
-
}, [currentNodeIndex, currentNode, onNodeChange, isPreloading, playlist.autoPlay, preloadedNodes]);
|
|
1235
|
+
}, [currentNodeIndex, currentNode, onNodeChange, isPreloading, playlist.autoPlay, preloadedNodes, editableNodes]);
|
|
1209
1236
|
const handleNodePreloaded = (nodeIndex) => {
|
|
1210
1237
|
console.log(`\u2705 [MMDPlaylist] \u8282\u70B9 ${nodeIndex} \u9884\u52A0\u8F7D\u5B8C\u6210`);
|
|
1211
1238
|
setPreloadedNodes((prev) => {
|