Browse Source

feat: add hls.js and live session/stop APIs

main
xiaosi 3 weeks ago
parent
commit
0298c51b5e
  1. 7
      package-lock.json
  2. 1
      package.json
  3. 8
      src/api/live.js
  4. 2
      src/config/urls.js

7
package-lock.json

@ -9,6 +9,7 @@
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"axios": "^1.6.8", "axios": "^1.6.8",
"hls.js": "^1.7.1",
"less": "^4.9.0", "less": "^4.9.0",
"mapbox-gl": "^3.29.0", "mapbox-gl": "^3.29.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",
@ -1429,6 +1430,12 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/hls.js": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.7.1.tgz",
"integrity": "sha512-DlzIkeBAS9IIQ432k3BUf3HlwbsR0+trB1i2lDdN2gUkNkrehFurh0/48M5c1/EjlDkdGng1gwZIpwyPxvdZ/g==",
"license": "Apache-2.0"
},
"node_modules/http-proxy-agent": { "node_modules/http-proxy-agent": {
"version": "9.1.0", "version": "9.1.0",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-9.1.0.tgz", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-9.1.0.tgz",

1
package.json

@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^1.6.8", "axios": "^1.6.8",
"hls.js": "^1.7.1",
"less": "^4.9.0", "less": "^4.9.0",
"mapbox-gl": "^3.29.0", "mapbox-gl": "^3.29.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",

8
src/api/live.js

@ -4,6 +4,10 @@ export function joinLive(dockId, payload = {}) {
return request.post(`/v1/live/${dockId}/sessions`, payload) return request.post(`/v1/live/${dockId}/sessions`, payload)
} }
export function getLiveSession(dockId, sessionId) {
return request.get(`/v1/live/${dockId}/sessions/${sessionId}`)
}
export function getLivePlayURL(dockId, sessionId) { export function getLivePlayURL(dockId, sessionId) {
return request.get(`/v1/live/${dockId}/play-url`, { return request.get(`/v1/live/${dockId}/play-url`, {
params: { streamSessionId: sessionId } params: { streamSessionId: sessionId }
@ -17,3 +21,7 @@ export function heartbeatLive(dockId, sessionId) {
export function leaveLive(dockId, sessionId) { export function leaveLive(dockId, sessionId) {
return request.delete(`/v1/live/${dockId}/sessions/${sessionId}/viewers/me`) return request.delete(`/v1/live/${dockId}/sessions/${sessionId}/viewers/me`)
} }
export function stopLive(dockId) {
return request.post(`/v1/live/${dockId}/stop`)
}

2
src/config/urls.js

@ -39,6 +39,8 @@ export const LIVE_SESSIONS = (dockId) => `/v1/live/${dockId}/sessions`
export const LIVE_PLAY_URL = (dockId) => `/v1/live/${dockId}/play-url` export const LIVE_PLAY_URL = (dockId) => `/v1/live/${dockId}/play-url`
export const LIVE_HEARTBEAT = (dockId, sessionId) => `/v1/live/${dockId}/sessions/${sessionId}/heartbeat` export const LIVE_HEARTBEAT = (dockId, sessionId) => `/v1/live/${dockId}/sessions/${sessionId}/heartbeat`
export const LIVE_LEAVE = (dockId, sessionId) => `/v1/live/${dockId}/sessions/${sessionId}/viewers/me` export const LIVE_LEAVE = (dockId, sessionId) => `/v1/live/${dockId}/sessions/${sessionId}/viewers/me`
export const LIVE_SESSION = (dockId, sessionId) => `/v1/live/${dockId}/sessions/${sessionId}`
export const LIVE_STOP = (dockId) => `/v1/live/${dockId}/stop`
export const VIDEOS = '/v1/videos' export const VIDEOS = '/v1/videos'
export const VIDEO_DOWNLOAD = (id) => `/v1/videos/${id}/download` export const VIDEO_DOWNLOAD = (id) => `/v1/videos/${id}/download`

Loading…
Cancel
Save