OpenVidu / openvidu

OpenVidu Platform main repository

Home Page:https://openvidu.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

openvidu-browser: streamPropertyChanged for reason 'deviceRotated' not emitted on iOS

semmel opened this issue · comments

Describe the bug
When publishing my own video stream, no streamPropertyChanged events are emitted when the iOS device is rotated.

Expected behavior
When changing the orientation of the iOS device a streamPropertyChanged event with reason='deviceRotated' and property='videoDimensions' should be emitted.

Wrong current behavior
The onOrientationChanged handler calls the method Publisher.getVideoDimensions() which throws in the line document.body.removeChild(this.videoReference). Thus, OpenVidu.sendNewVideoDimensionsIfRequired() cannot continue to call OpenVidu.sendVideoDimensionsChangedEvent().

OpenVidu tutorial where to replicate the error

  1. Any HTML page with a button, a video element and openvidu-browser v2.21–v2.27:
<video autoplay playsinline muted></video>
<button type="button">Get Cam</button>
<script src="../node_modules/openvidu-browser/static/js/openvidu-browser-2.27.0.js"></script>
  1. Create your own MediaStreamTrack with kind = 'video' and attach to <video>
button.addEventListener('click', () => {
    navigator.mediaDevices.getUserMedia({video: true})
    .then(mediaStream => {
         videoElement.srcObject = mediaStream;
         localVideoTrack = mediaStream.getVideoTracks()[0];
   })
})
  1. Connect Safari Developer Tools
  2. Acquire MediaStream from the webcam by tapping <button>
  3. Execute the usual workflow to publish the video
    1. var OV = new OpenVidu();
    2. var session = OV.initSession();
    3. var publisher = await OV.initPublisherAsync(null, {audioSource: false, videoSource: localVideoTrack});
    4. var token = await getAccessToken(); // <-- fetch from your server
    5. await session.connect(token);
    6. session.publish(publisher);
  4. Rotate the device
  5. Observe the exception "Unhandled Promise Rejection: NotFoundError: The object can not be found here." - Publisher.ts line 723 in the DevTools console

OpenVidu deployment info

  • OpenVidu CE v2.21
  • openvidu-node-client v2.21

Client device info (if applicable)

  • Safari on iOS v16.5
  • openvidu-browser v2.21 - v2.27

Additional context
#795 might be a related issue