Skip to content

Commit 455fca7

Browse files
committed
Add Video Duration to Web API
1 parent 97d0596 commit 455fca7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/utils/clArgs.js

+8
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ function startWebApi(el) {
116116
} else err()
117117
})
118118

119+
app.get('/duration', (req, res) => {
120+
if (((player || {}).wcjs || {}).length) {
121+
res.setHeader('Content-Type', 'application/json; charset=utf-8')
122+
123+
res.send(JSON.stringify({ duration: player.wcjs.length }))
124+
} else err()
125+
})
126+
119127
app.get('/state', (req, res) => {
120128
if (((player || {}).wcjs || {}).state) {
121129
const states = ['NothingSpecial', 'Opening', 'Buffering', 'Playing', 'Paused', 'Stopped', 'Ended', 'Error']

0 commit comments

Comments
 (0)