Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135281

Qml Camera not work on webassembly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.8.3, 6.9.0 RC
    • Multimedia
    • None
    • WebAssembly

    Description

       

      It works on Qt6.8.2, but it doesn't work in Qt6.8.3 and Qt6.9.0rc. When set cameraDevice such as  camera.cameraDevice =  mediaDevices.videoInputs[index], lots of  warnings and the browser console will be unresponsive. 

      Demo:

      // code placeholder
      import QtQuick
      import QtMultimedia
      import QtQuick.Controls
      import QtCore
      ApplicationWindow{
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")   
       Rectangle {
              anchors.fill: parent
              CaptureSession {
                  // id:captureSession
                  imageCapture : ImageCapture {
                      id: imageCapture
                  }
                  camera:Camera {
                      id: camera
                      focusMode: Camera.FocusModeAuto
                      // Camera.FocusModeAutoNear
                      // 6.7.2 wasm(Cannot read properties of null (reading 'getVideoTracks'))
                      // 6.8.2 cannot read properties of undefined(reading 'srcObject')
                      customFocusPoint: Qt.point(0.5, 0.5)
                      onCameraDeviceChanged: start()
                  }
                  videoOutput: videoOutput
              }
              VideoOutput {
                  id: videoOutput
                  clip:true
                  anchors.fill: parent
                  fillMode: VideoOutput.PreserveAspectCrop
              }
          }
          MediaDevices {
              id:mediadevices
          }
          CameraPermission {
              id:cameraPermission
          }
          footer: Button {
              text:"test"
              onClicked:{
                  console.log(mediadevices.videoInputs)
                  camera.cameraDevice = mediadevices.videoInputs[0]
              }
          }
          Component.onCompleted: {
              cameraPermission.request()
              // First Time Maybe need to refresh site
          }
      }
       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            artemiy Artem Dyomin
            lzhdsd lzh lzh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes