69 void seekTo(qint64 position);
84 void setHasAudio(
bool needsAudio) { m_hasAudio = needsAudio; }
94 m_video.isNull() || m_video.isUndefined() ? emscripten::val::null()
115 void checkNetworkState();
116 void playVideoElement();
117 void videoComputeFrame(
void *context);
118 void getDeviceSettings();
119 bool isPlatformiOs();
120 void detectIosCameraRotation();
121 void applyIosRotation(
int orientationIndex);
126 float m_requestedPosition = 0.0;
129 int getCurrentOrientationIndex();
132 bool m_isStopped =
false;
133 bool m_toBePaused =
false;
134 bool m_isSeeking =
false;
135 bool m_hasAudio =
false;
136 bool m_cameraIsReady =
false;
137 bool m_shouldBeStarted =
false;
138 bool m_streamStarted =
false;
139 bool m_isSeekable =
false;
140 bool m_useCameraRotation =
false;
142 QSize m_pendingVideoSize;
144 QMediaPlayer::MediaStatus m_currentMediaStatus;
145 qreal m_currentBufferedValue;
146 JsMediaInputStream *m_mediaInputStream =
nullptr;
148 QScopedPointer<QWasmEventHandler> m_timeUpdateEvent;
149 QScopedPointer<QWasmEventHandler> m_playEvent;
150 QScopedPointer<QWasmEventHandler> m_endedEvent;
151 QScopedPointer<QWasmEventHandler> m_durationChangeEvent;
152 QScopedPointer<QWasmEventHandler> m_loadedDataEvent;
153 QScopedPointer<QWasmEventHandler> m_errorChangeEvent;
154 QScopedPointer<QWasmEventHandler> m_resizeChangeEvent;
155 QScopedPointer<QWasmEventHandler> m_loadedMetadataChangeEvent;
156 QScopedPointer<QWasmEventHandler> m_loadStartChangeEvent;
157 QScopedPointer<QWasmEventHandler> m_canPlayChangeEvent;
158 QScopedPointer<QWasmEventHandler> m_canPlayThroughChangeEvent;
159 QScopedPointer<QWasmEventHandler> m_seekingChangeEvent;
160 QScopedPointer<QWasmEventHandler> m_seekedChangeEvent;
161 QScopedPointer<QWasmEventHandler> m_emptiedChangeEvent;
162 QScopedPointer<QWasmEventHandler> m_stalledChangeEvent;
163 QScopedPointer<QWasmEventHandler> m_waitingChangeEvent;
164 QScopedPointer<QWasmEventHandler> m_playingChangeEvent;
165 QScopedPointer<QWasmEventHandler> m_progressChangeEvent;
166 QScopedPointer<QWasmEventHandler> m_pauseChangeEvent;
167 QScopedPointer<QWasmEventHandler> m_beforeUnloadEvent;
169 std::string m_cameraId;
170 QMetaObject::Connection m_connection;
171 QSize m_videoResolution;
172 float m_minFrameRate = 0;
173 float m_maxFrameRate = 0;
174 float m_streamFrameRate = 0;
175 static bool orientationchangeCallback(
int eventType,
const EmscriptenOrientationChangeEvent *orientationChangeEvent,
void *userData);
EM_JS(void, em_texImage2DFromVideo,(const char *videoId, int *widthOut, int *heightOut), { videoId=Number(videoId);widthOut=Number(widthOut);heightOut=Number(heightOut);var gl=GL.currentContext.GLctx;var video=document.getElementById(UTF8ToString(videoId));if(!video) { return;} var frame;try { frame=new VideoFrame(video);} catch(e) { return;} HEAP32[widthOut/4]=frame.displayWidth;HEAP32[heightOut/4]=frame.displayHeight;gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, frame);frame.close();})