简体   繁体   English

将屏幕从Android手机投射到Android平板电脑

[英]Casting screen from Android mobile to Android Tablet

I need to develop 2 applications "Sender" and "Receiver". 我需要开发2个应用程序“ Sender”和“ Receiver”。 These two will perform screen mirroring from Sender to Receiver. 这两个将执行从发送方到接收方的屏幕镜像。

How can I do this? 我怎样才能做到这一点? Are there any in-built APIs / libraries available for same? 是否有任何内置的API /库可供使用? Can I use Miracast to achiave this? 我可以使用Miracast做到这一点吗? If, yes please guide me. 如果可以,请指导我。

Assumption: Both device will be remain on same wifi. 假设:两个设备都将保留在同一wifi上。

To collect the UI from Sender, you can try creating something that looks like my MirroringFrameLayout from the CWAC-Layouts library . 要从Sender收集UI,您可以尝试从CWAC-Layouts库创建类似于我的MirroringFrameLayout 的内容 That is designed to update a separate Mirror View for on the same device that has the MirroringFrameLayout , such as having the MirroringFrameLayout on the touchscreen and the Mirror shown on an external display via a Presentation . 这样做的目的是为了在具有MirroringFrameLayout的同一设备上更新单独的Mirror View ,例如通过Presentation在触摸屏上显示MirroringFrameLayout并在外部显示器上显示Mirror

The problem you will encounter is performance, as my current approach draws the entire MirrorFrameLayout contents to a Bitmap , which is then shown by the Mirror . 您将遇到的问题是性能,因为我当前的方法将整个MirrorFrameLayout内容绘制到一个Bitmap ,然后由Mirror That would require you to ship new bitmaps across the network connection on every UI change, which is likely to be slow. 这将要求您在每次UI更改时通过网络连接发送新的位图,这可能很慢。 So, while my approach is easy, you may need to be much more aware of what your UI is doing so you can ship over smaller updates. 因此,尽管我的方法很简单,但您可能需要更加了解UI的功能,以便可以发布较小的更新。

The best approach may be to stop thinking of "screen mirroring" entirely, and instead focus on "operation mirroring". 最好的方法可能是完全不要考虑“屏幕镜像”,而应该专注于“操作镜像”。 For example, suppose Sender is a drawing app, and Receiver is supposed to see the drawings. 例如,假设Sender是一个绘图应用程序,而Receiver应该可以看到绘图。 Rather than sending over the screens, send over the drawing operations that the user performs, and apply those same operations on the Receiver. 而不是通过屏幕发送,而是发送用户执行的绘图操作,并将这些相同的操作应用于接收器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM