替换窗口时附带之前窗口的状态信息

This commit is contained in:
fangxiang 2022-04-08 11:34:55 +08:00
parent 2c13c31f7a
commit 191793fbf3
4 changed files with 65 additions and 33 deletions

View File

@ -14,7 +14,7 @@ export class MultimediaWindowEntity extends BaseEntity {
volume: number = 80; volume: number = 80;
muted: boolean = false; muted: boolean = false;
playing: boolean = false; paused: boolean = false;
play_speed: number = 1; play_speed: number = 1;
polling: boolean = false; polling: boolean = false;
polling_uuid: string = ""; polling_uuid: string = "";

View File

@ -2,7 +2,7 @@ import { Protocol } from "./WSProtocol";
export default class WindowOtherStateChangeNotifyEntity extends Protocol.PacketEntity { export default class WindowOtherStateChangeNotifyEntity extends Protocol.PacketEntity {
window_id: number = 0; window_id: number = 0;
playing = false; paused = false;
muted = false; muted = false;
volume = 80; volume = 80;
polling = false; polling = false;

View File

@ -28,7 +28,7 @@
round round
flag flag
size="lg" size="lg"
v-if="!selected_window?.playing" v-if="selected_window?.paused"
:disable="!can_pause_window || plan_running" :disable="!can_pause_window || plan_running"
icon="play_arrow" icon="play_arrow"
@click="play" @click="play"
@ -156,6 +156,7 @@ export default defineComponent({
); );
if (window) { if (window) {
selected_window.value = window; selected_window.value = window;
console.log(window);
const signal_source = GlobalData.getInstance().signal_source.find( const signal_source = GlobalData.getInstance().signal_source.find(
(element) => (element) =>
element && element.uuid == window.signal_source_table_uuid element && element.uuid == window.signal_source_table_uuid

View File

@ -518,8 +518,8 @@ export default defineComponent({
$store.commit("setWindowPropertys", [ $store.commit("setWindowPropertys", [
{ {
window, window,
property_name: "playing", property_name: "paused",
value: temp.playing, value: temp.paused,
}, },
{ {
window, window,
@ -708,7 +708,7 @@ export default defineComponent({
const y = dom.offsetTop / wall.value.clientHeight; const y = dom.offsetTop / wall.value.clientHeight;
const width = dom.offsetWidth / wall.value.clientWidth; const width = dom.offsetWidth / wall.value.clientWidth;
const height = dom.offsetHeight / wall.value.clientHeight; const height = dom.offsetHeight / wall.value.clientHeight;
console.log(type);
switch (type) { switch (type) {
case "polling": case "polling":
GlobalData.getInstance() GlobalData.getInstance()
@ -743,7 +743,7 @@ export default defineComponent({
break; break;
} }
} else if (dom.classList.contains("window_flag")) { } else if (dom.classList.contains("window_flag")) {
// //
const rep_uuid = dom.getAttribute("uuid"); const rep_uuid = dom.getAttribute("uuid");
if (rep_uuid) { if (rep_uuid) {
let window = $store.state.windows.find( let window = $store.state.windows.find(
@ -758,39 +758,68 @@ export default defineComponent({
let height = window.height; let height = window.height;
client.closeWindow(window.window_id); client.closeWindow(window.window_id);
setTimeout(() => { const open_window_request =
switch (type) {
case "polling":
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(
new Protocol.OpenPollingRequestEntity( new Protocol.OpenPollingRequestEntity(
uuid, uuid,
x, x,
y, y,
width, width,
height height
)
); );
break; open_window_request.muted = window.muted;
case "signal_source": open_window_request.volume = window.volume;
if (signal_sources.length) { open_window_request.paused = window.paused;
const signal_source = signal_sources[0]; open_window_request.play_speed = window.play_speed;
if (signal_source) {
client?.openWindow( console.log(window);
new Protocol.OpenWindowRequestEntity(
signal_source.uuid, //setTimeout(() => {
switch (type) {
case "polling":
{
const open_polling_request =
new Protocol.OpenPollingRequestEntity(
uuid,
x, x,
y, y,
width, width,
height height
)
); );
open_polling_request.muted = window.muted;
open_polling_request.volume = window.volume;
open_polling_request.paused = window.paused;
open_polling_request.play_speed = window.play_speed;
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(open_polling_request);
}
break;
case "signal_source":
{
const open_window_request =
new Protocol.OpenWindowRequestEntity(
uuid,
x,
y,
width,
height
);
open_window_request.muted = window.muted;
open_window_request.volume = window.volume;
open_window_request.paused = window.paused;
open_window_request.play_speed = window.play_speed;
if (signal_sources.length) {
const signal_source = signal_sources[0];
if (signal_source) {
client?.openWindow(open_window_request);
} }
} }
}
break; break;
} }
}, 100); //}, 100);
} }
} }
} }
@ -1040,6 +1069,7 @@ export default defineComponent({
} }
}, },
async repliceWindow(window_id: number) { async repliceWindow(window_id: number) {
// ,
if (!wall.value) { if (!wall.value) {
return; return;
} }
@ -1113,9 +1143,10 @@ export default defineComponent({
old_window.width, old_window.width,
old_window.height old_window.height
); );
open_window_request.muted = old_window.muted; open_window_request.muted = old_window.muted;
open_window_request.volume = old_window.volume; open_window_request.volume = old_window.volume;
open_window_request.paused = !old_window.playing; open_window_request.paused = old_window.paused;
open_window_request.play_speed = old_window.play_speed; open_window_request.play_speed = old_window.play_speed;
GlobalData.getInstance() GlobalData.getInstance()