android - 显示在前台服务中创建的 SurfaceTexture 到 Activity ?

标签 android camera surface

我正在使用 SurfaceTexture我在 ForegroundService 中创建的无需任何视频即可从相机捕获视频 ActivitySurfaceView .

如何显示我的 SurfaceTextureActivity ?

我一直在寻找类似 SurfaceView.setSurfaceTexture() 的东西或接受 SurfaceTexture 的构造函数但我找不到任何东西。

最佳答案

我建议你创建一个 SurfaceView在服务中通过调用构造函数像这样:

new SurfaceView(getApplicationContext());

因此,作为 SurfaceView 的上下文使用所有应用程序通用的上下文创建,您可以正确添加您的 SurfaceViewActivity 的内容 View 中当你需要的时候。

否则,您可以查看this answer实现 MediaPlayer列出了一个 SurfaceSurfaceTexture 创建.

关于android - 显示在前台服务中创建的 SurfaceTexture 到 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49756666/

相关文章:

android - 如何使用 espresso 测试用例库单击工具栏中的菜单选项

android - 在 phonegap 内调用和监控电话

底部栏中的android溢出菜单

MATLAB pcolor/surf 双线性插值(着色插值)

android:如何取消方向更改

azure - 如何让相机在 Azure 虚拟机上工作

opengl - 眼空间坐标到底是什么?

ios - iPhone : Photos framework : how to get only those album/images which created by my app only not by others?

python - 有没有办法从 matplotlib 曲面图导出 STL 文件?

ios - SpriteKit - 在 iOS 中使用 Swift 从上面的角度看海面