Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwasmmediadevices.cpp File Reference

(3d4fba00ae895807eabe9d8b0f99f4166e4235a6)

#include "qwasmmediadevices_p.h"
#include "private/qcameradevice_p.h"
#include "private/qplatformmediaintegration_p.h"
#include "qwasmwebaudiosource_p.h"
#include "qwasmwebaudiosink_p.h"
#include "qwasmaudiodevice_p.h"
#include <QMap>
#include <QDebug>
#include <emscripten.h>
Include dependency graph for qwasmmediadevices.cpp:

Go to the source code of this file.

Functions

QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC (QWasmMediaDevices, s_wasmMediaDevicesInstance)
bool isFirefox ()
EMSCRIPTEN_KEEPALIVE void qtMediaDevicesOnAudioOutputSelected ()
 EM_JS (void, setupAudioOutputSelector,(), { const overlay=document.createElement('div');overlay.style.cssText='position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.5);z-index:9999;display:flex;align-items:center;justify-content:center;';const dialog=document.createElement('div');dialog.style.cssText='background:white;padding:24px;border-radius:8px;text-align:center;font-family:sans-serif;min-width:240px;';const message=document.createElement('p');message.textContent='Select an audio output device to continue.';message.style.cssText='margin:0 0 16px 0;font-size:14px;';const button=document.createElement('button');button.textContent='Select Audio Output';button.style.cssText='padding:8px 16px;font-size:14px;cursor:pointer;';button.addEventListener('click', async()=> { document.body.removeChild(overlay);try { const deviceInfo=await navigator.mediaDevices.selectAudioOutput();console.log("Selected device: ", deviceInfo.label);Module._qtMediaDevicesOnAudioOutputSelected();} catch(err) { console.error(err);} }, { once:true });dialog.appendChild(message);dialog.appendChild(button);overlay.appendChild(dialog);document.body.appendChild(overlay);})

Function Documentation

◆ EM_JS()

EM_JS ( void ,
setupAudioOutputSelector ,
() ,
{ const overlay=document.createElement('div');overlay.style.cssText='position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.5);z-index:9999;display:flex;align-items:center;justify-content:center;';const dialog=document.createElement('div');dialog.style.cssText='background:white;padding:24px;border-radius:8px;text-align:center;font-family:sans-serif;min-width:240px;';const message=document.createElement('p');message.textContent='Select an audio output device to continue.';message.style.cssText='margin:0 0 16px 0;font-size:14px;';const button=document.createElement('button');button.textContent='Select Audio Output';button.style.cssText='padding:8px 16px;font-size:14px;cursor:pointer;';button.addEventListener('click', async()=> { document.body.removeChild(overlay);try { const deviceInfo=await navigator.mediaDevices.selectAudioOutput();console.log("Selected device: ", deviceInfo.label);Module._qtMediaDevicesOnAudioOutputSelected();} catch(err) { console.error(err);} }, { once:true });dialog.appendChild(message);dialog.appendChild(button);overlay.appendChild(dialog);document.body.appendChild(overlay);}  )

References EM_JS().

Referenced by EM_JS().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFirefox()

bool isFirefox ( )

Definition at line 22 of file qwasmmediadevices.cpp.

Referenced by QWasmMediaDevices::initDevices().

Here is the caller graph for this function:

◆ Q_GLOBAL_STATIC()

QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC ( QWasmMediaDevices ,
s_wasmMediaDevicesInstance  )

◆ qtMediaDevicesOnAudioOutputSelected()

EMSCRIPTEN_KEEPALIVE void qtMediaDevicesOnAudioOutputSelected ( )

Definition at line 29 of file qwasmmediadevices.cpp.

References QWasmMediaDevices::getMediaDevices(), and QWasmMediaDevices::instance().

Here is the call graph for this function: