Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

相机拍照返回黑图片 #2

Open
longyiyiyu opened this issue Feb 2, 2019 · 1 comment
Open

相机拍照返回黑图片 #2

longyiyiyu opened this issue Feb 2, 2019 · 1 comment
Labels
camera about camera experience learn from this

Comments

@longyiyiyu
Copy link
Contributor

longyiyiyu commented Feb 2, 2019

使用 <camera> 元素
使用如下代码拍照

const ctx = wx.createCameraContext();
ctx.takePhoto({ ... })

拍出来的图片是全黑的

@longyiyiyu longyiyiyu added experience learn from this camera about camera labels Feb 2, 2019
@longyiyiyu
Copy link
Contributor Author

longyiyiyu commented Feb 2, 2019

原因是 <camera> 元素还没有初始化完成,也就是系统相机还没有初始化完成,所以这时候拍照返回的就是全黑的图片了。

但是因为小程序不提供任何回调告诉开发者说相机初始化成功了,所以只能适当的 setTimeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
camera about camera experience learn from this
Projects
None yet
Development

No branches or pull requests

1 participant