Android screen sharing programmatically (Root)

2019-04-21 11:13发布

问题:

Is it possible to screen sharing from root adb shell without user interaction over mircast or chromecast in Android >= 5?

I'm looking for the command that enables/disables this https://support.google.com/nexus/answer/2865484?hl=en

回答1:

You can try the Media Router - Secondary Output APIs from Android SDK:

The Android media router APIs are designed to enable media display and playback on these secondary devices. There are two main approaches you can use to play content using these APIs:

Remote Playback — This approach uses the receiving device to handle the content data retrieval, decoding, and playback, while an Android device in the user's hand is used as a remote control. This approach is used by Android apps that support Google Cast.

Secondary Output — With this approach, your app retrieves, renders and streams video or music directly to the receiving device. This approach is used to support Wireless Display output on Android.

The secondary output approach sends prepared media content to a connected secondary device for playback. Secondary devices can include televisions or wireless sound systems and can be attached through wireless protocols or wires, such as an HDMI cable. With this approach, your app is responsible for processing media content for playback (downloading, decoding, synchronization of audio and video tracks), while the secondary device only outputs the content in its final form.

Please see http://developer.android.com/guide/topics/media/mediarouter.html for further details