Failed to start video surface due to main stream error in QML

I wrote a sample QML-qt5 application for displaying a webcam, giving an error: OS: UBUNTU 13.04 Qt Creator 2.7.1 based on Qt 5.0.2 (64 bit)

Failed to start video surface due to main thread blocked. Failed to start video surface CameraBin error: "Internal data flow error." 

PS: this error occurs randomly and in most cases; let's say 18-19 times 20 times

Here is the code:

 import QtQuick 2.0 import QtMultimedia 5.0 Item { width: 320 height: 240 VideoOutput { id:camOutput source: camera anchors.fill: parent focus : visible // to receive focus and capture key events when visible } Camera { id: camera imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash exposure { exposureCompensation: -1.0 exposureMode: Camera.ExposurePortrait } flash.mode: Camera.FlashRedEyeReduction imageCapture { onImageCaptured: { photoPreview.source = preview // Show the preview in an Image } } } Image { id: photoPreview } } 
+4
source share
1 answer

This is a bug in Qt - see QTBUG-39567 .

When writing this post (June 2017) there is no actual solution, but a workaround is proposed:

Do not play the video immediately after starting the application - wait one second before starting your video player.

I tested this and it fixed my problem with video playback.

In your case, this is not a video player, but, in my opinion, it is connected with all components of QtMultimedia .

+1
source

Source: https://habr.com/ru/post/1490078/


All Articles