Skip to content

[Bug]: navigator.mediaDevices.getUserMedia({video: true}) in Telegram-Mini-App returns black stream on iOS #748

@alexeyhimself

Description

@alexeyhimself

Telegram Application

Telegram for iOS

Describe the Bug

I tested camera access on Telegram Mini-App. So, I found a minimal JS code app for a video streaming - https://jsfiddle.net/rxbe1zj3 - that uses navigator.mediaDevices.getUserMedia({video: true}). So, I opened this link on Safari on iOS and it worked. Then I added this link as a mini-app URL and opened it from Telegram to test mini-app browser compatibility, and it didn't work: it always returned a black screen.

An interesting thing that I also found was using https://developer.mozilla.org/en-US/docs/Web/API/Media_Capture_and_Streams_API/Taking_still_photos as a mini-app URL too, and navigating to "Open example in a new window" URL - and although the video stream was black too there I could capture photos. I.e. the video stream actually works, but is (maybe) intentionally made black.

Also I need to add that on MacOS mini-app the camera from https://jsfiddle.net/rxbe1zj3 works fine.
As to Android, the stream from camera starts working if we hit "Run" button on jsfiddle page.
So, it's mainly an iOS thing.

To Reproduce

Steps to reproduce

  1. In BotFather set mini-app URL for a bot to: https://jsfiddle.net/rxbe1zj3
  2. Open mini-app in a bot
  3. Allow app access to the camera
  4. Check video stream from camera in an app

Actual result:
Black screen instead of a video stream
Image

Expected Behavior

Expected result:
Video stream from camera is displayed the same way as it is displayed for Safari / Chrome / FireFox web browsers on the same device for the same jsfiddle link:
Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions