use this library: https://github.com/phoboslab/jsmpeg with Vue-CLI.
More specifically I'd like to stream to the frontend using the libraries websocket relay node.js server.
The server & ffmpeg encoding & displaying it with the small viewer (view-stream.html, also in the repo) works. So far so good and it works really good with about 0.2 s delay.
Now the next step is to try to integrate it in my vue.js frontend, code is superstraight forward and looks like this:
<template>
<div>
<h1>jsmpeg Test</h1>
<canvas ref="canvas" width="300" height="300"></canvas>
</div>
</template>
<script>
import JSMpeg from 'jsmpeg'
export default {
name: 'jsmpeg',
data() {
return {
msg: 'Welcome to Your Vue.js App',
}
},
mounted() {
const canvas = this.$refs.canvas
const client = new WebSocket('ws://localhost:8082/')
const player = new JSMpeg(client, { canvas })
},
}
</script>
so basically, this is just this is just the streaming example mentioned here: https://www.npmjs.com/package/jsmpeg
applied in vue.js.
I get the following errors:
Uncaught TypeError: Cannot set property '0' of null
But only when the stream is actually on and something gets received on the websockets...
Where is my mistake?
oof are u phobos?
Обсуждают сегодня