Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 处理流式视频外部屏幕_Android_Android Activity - Fatal编程技术网

Android 处理流式视频外部屏幕

Android 处理流式视频外部屏幕,android,android-activity,Android,Android Activity,我又遇到了一个新问题,基本上现在我得到了一个要求,应用程序需要在移动Android上传输视频,但是如果应用程序有第二个输出,它不应该在任何其他外部输出中显示应用程序内容或视频,它应该显示不同的布局,我一直在尝试使用Android的一些示例,同时也在研究API 我无法显示外部图像,以防它显示另一个输出。有什么想法我可以做到这一点。我错过什么了吗 目前,我正在尝试使用MediaRouter、DisplayManager演示来实现我的目标 1选项-使用MediaRouter public vo

我又遇到了一个新问题,基本上现在我得到了一个要求,应用程序需要在移动Android上传输视频,但是如果应用程序有第二个输出,它不应该在任何其他外部输出中显示应用程序内容或视频,它应该显示不同的布局,我一直在尝试使用Android的一些示例,同时也在研究API

我无法显示外部图像,以防它显示另一个输出。有什么想法我可以做到这一点。我错过什么了吗

目前,我正在尝试使用MediaRouter、DisplayManager演示来实现我的目标

1选项-使用MediaRouter

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        MediaRouter mediaRouter = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
        MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();

        if (route != null) {
             Display presentationDisplay = route.getPresentationDisplay();
             if (presentationDisplay != null) {
                 Presentation presentation = new DemoPresentation(this, presentationDisplay);
                 presentation.show();
             }
         }
         // Keep going here because theresnt presentation (secundary output) available

         setContentView(R.layout.video_player); 
        } 
2选项-使用DisplayManager

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
    Display[] presentationDisplays = mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
    if (presentationDisplays.length > 0) {
        // If there is more than one suitable presentation display, then we could consider
        // giving the user a choice.  For this example, we simply choose the first display
        // which is the one the system recommends as the preferred presentation display.
        Display display = presentationDisplays[0];
        Presentation presentation = new DemoPresentation(this, display);
        presentation.show();
    }
    // Keep going here because theresnt presentation (secundary output) available

    setContentView(R.layout.video_player); 
} 
这是演示文稿

  private final class DemoPresentation extends Presentation {
   final PresentationContents mContents = null;

   public DemoPresentation(Context context, Display display) {
       super(context, display);

   }

   @Override
   protected void onCreate(Bundle savedInstanceState) {
       // Be sure to call the super class.
       super.onCreate(savedInstanceState);
       // Get the resources for the context of the presentation.
       // Notice that we are getting the resources from the context of the presentation.
       // Inflate the layout.
       setContentView(R.layout.show_layout_external_screen);

  }

来自

Erm的示例。。。你的问题是什么?对不起,我只是编辑了我的问题,我无法显示外部图像,以防它显示另一个输出。有什么想法我可以做到这一点。我遗漏了什么吗?你是说一个屏幕播放视频,另一个屏幕显示缩略图吗?我希望能够始终在移动屏幕上显示视频,但如果存在任何其他输出,我只希望在第二个输出中显示另一个布局,在本例中为图像