Use explicit YouTube play pause actions
This commit is contained in:
@@ -221,14 +221,17 @@ const server = http.createServer(async (req, res) => {
|
||||
|
||||
const playlist = normalizePlaylist(payload.playlist);
|
||||
const videoId = String(payload.videoId || "").trim();
|
||||
const activeVideoId = playlist.some((item) => item.videoId === videoId) ? videoId : "";
|
||||
const action = payload.action === "play" && activeVideoId ? "play" : "pause";
|
||||
const watchState = {
|
||||
type: "watch-state",
|
||||
from: payload.from,
|
||||
name: normalizeName(payload.name),
|
||||
videoId: playlist.some((item) => item.videoId === videoId) ? videoId : "",
|
||||
videoId: activeVideoId,
|
||||
playlist,
|
||||
position: Number(payload.position) || 0,
|
||||
playing: Boolean(payload.playing),
|
||||
playing: action === "play",
|
||||
action,
|
||||
updatedAt: Number(payload.updatedAt) || Date.now()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user