mobile-packages
mobile-packages copied to clipboard
On Android/Chrome using camera failed with : Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.
Hi,
i try to use the camera on smartphone (android + chrome) and since few days i always have :
Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.
If i look at the package, the play() action is done on Template rendered, maybe it's the problem because the action is not triggered by user.
To reproduce:
- just add the mdg:camera
- render the template "camera" using {{> camera}} in your layout
- start an nginx as a proxy with SSL (because getUserMedia no more works without SSL)
- start meteor app
- open Chrome on your Android device
- fill the url of your computer
- The video stream is not displayed, but you only have a photo
just added a Pull Request (PR13) that solve problems on Android Chrome
In lieu of this PR being accepted, it looks like adding the following code to your app will hotfix the issue:
Template.viewfinder.onRendered(function() {
this.$("#video").attr("autoplay", "autoplay");
});
It seems to be a valid solution. Actually i use my own solution in my own fork of this pakages stored in /packages/mobile-packages folder.