File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
src/components/widgets/camera Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 1616 @update:camera-name-menu-items =" cameraNameMenuItems = $event"
1717 @update:raw-camera-url =" rawCameraUrl = $event"
1818 @update:frames-per-second =" framesPerSecond = $event"
19- @playback =" setupFrameEvents()"
2019 />
2120 </template >
2221 <div v-else >
@@ -131,14 +130,11 @@ export default class CameraItem extends Vue {
131130 cameraName = ' '
132131 cameraNameMenuItems: CameraNameMenuItem [] = []
133132
134- mounted () {
135- this .setupFrameEvents ()
136- }
137-
138- setupFrameEvents () {
139- if (this .$listeners ?.frame && this .componentInstance ) {
133+ @Watch (' status' )
134+ onStatus (value : CameraConnectionStatus ) {
135+ if (value === ' connected' && this .$listeners ?.frame && this .componentInstance ) {
140136 if (this .componentInstance .streamingElement instanceof HTMLImageElement ) {
141- this .componentInstance . streamingElement . addEventListener ( ' load ' , () => this . handleFrame () )
137+ this .handleFrame ()
142138 } else if (this .componentInstance .streamingElement instanceof HTMLVideoElement ) {
143139 this .handleFrame (true )
144140 }
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ export default class DeviceCamera extends Mixins(CameraMixin) {
2727 const stream = await this .getUserMedia ()
2828
2929 this .cameraVideo .srcObject = stream
30- this .$emit (' playback' )
3130
3231 this .updateCameraName (await this .getDeviceLabel () ?? ' ' )
3332 } catch (e ) {
You can’t perform that action at this time.
0 commit comments