Android、DLNA 投影到智能电视

发布于 2024-12-14 06:23:34 字数 49 浏览 3 评论 0原文

知道如何通过 Android 应用程序将照片通过 DLNA 投影到任何智能电视上吗?

Any Idea of how to make DLNA projection of photos onto any smart TVs through Android Application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

唠甜嗑 2024-12-21 06:23:34

您将需要两个组件:

  • 一个支持 DLNA 的 upnp 堆栈(例如 cling
  • 一个非常简单的嵌入式网络服务器(我建议您自己编写此内容,您很快就会明白原因)

无论您的堆栈实现是什么,步骤都是这样的:

  1. 在 upnp 堆栈内启动设备发现,然后稍等片刻看看可以在哪些渲染设备上找到网络
  2. 检查哪些设备能够播放图像(从设备功能),并让用户
  3. 从所选设备中选择其中之一,使用传输服务并
  4. 使用传输服务渲染服务,使用您自己选择的 URI 调用 setTransportUri。只需 IP 地址需要指向您自己的设备,但后面的路径可以是任何内容。
  5. 远程渲染器将对您提供的 URI 发出 HTTP GET 请求。
  6. HTTP GET 请求会自动转发到您自己的小型网络服务器,该服务器现在应该正在侦听您提供的端口。
  7. 现在确保传入的 HTTP GET URI 与您在 setTransportURI 中提供的 URI 匹配。出于安全原因,您应该忽略所有其他 HTTP GET URI 以及所有其他类型的 HTTP 请求。如果匹配,则将文件的内容返回给渲染器。在这里你可以使用你自己喜欢的一些类库。
  8. 现在您等待 setTransportURI 完成。这可以通过观察传输服务的 TransportUri 状态属性来完成。
  9. 现在您在渲染服务中调用 play(如果您想确保状态转换发生,请等到状态属性变为 Playing),
  10. 就这样,图像显示在渲染器上!

you will need two components:

  • a DLNA-capable upnp stack (such as cling)
  • a very simple embedded webserver (I recommend writing this yourself, you'll soon see why)

The steps go like this, pretty much regardless of what is your stack implementation:

  1. start device discovery inside the upnp stack and wait a moment to see which rendered devices can be found on the network
  2. check which of the devices are capable of playing images (from the device capabilities) and let user select one of those
  3. from the selected device, use the transport service and rendering service
  4. using the transport service, call setTransportUri with a URI with your own selection. just the IP address needs to point to your own device, buth the path that follows can be anything.
  5. the remote renderer will issue a HTTP GET request for the URI you gave.
  6. the HTTP GET request is auto-forwarded to your own mini-webserver, which should by now be listening to the port you provided.
  7. now make sure that the incoming HTTP GET URI matches the URI you gave in setTransportURI. For security reasons you should ignore all other HTTP GET URI's, and all other types of HTTP requests. If it matches, return the content of the file to the renderer. Here you can use some class library of your own preference.
  8. Now you wait setTransportURI to be completed. This can be done by observing the transport service's transportUri state attribute.
  9. now you call play in the rendering service (and wait until the state attribute becomes playing, if you want to be sure the state transition occurred)
  10. that's it, the image is shown on the renderer!
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文