Files
wvp/web/src/store/modules/play.js
2025-04-28 15:04:06 +08:00

51 lines
1.2 KiB
JavaScript

import { broadcastStart, broadcastStop, play, stop } from '@/api/play'
const actions = {
play({ commit }, [deviceId, channelId]) {
return new Promise((resolve, reject) => {
play(deviceId, channelId).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
},
stop({ commit }, [deviceId, channelId]) {
return new Promise((resolve, reject) => {
stop(deviceId, channelId).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
},
broadcastStart({ commit }, [deviceId, channelId, broadcastMode]) {
return new Promise((resolve, reject) => {
broadcastStart(deviceId, channelId, broadcastMode).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
},
broadcastStop({ commit }, [deviceId, channelId]) {
return new Promise((resolve, reject) => {
broadcastStop(deviceId, channelId).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
}
}
export default {
namespaced: true,
actions
}