Google TV VideoView playing YouTube rtsp videos

穿精又带淫゛_ 提交于 2019-12-08 09:56:47

问题


I am accessing a video link via the YouTube API thusly:

JSONObject(videoString).getJSONObject("entry")
                .getJSONObject("media$group").getJSONArray("media$content")
                .getJSONObject(0).getString("url");

Which gives me a link to a video such as:

rtsp://v7.cache5.c.youtube.com/CiILENy73wIaGQlXg0iXvlQ9SBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp

I then try to play the video with:

        mVideoView.setVideoURI(result);
        final MediaController mediaController = new MediaController(mActivity);
        mVideoView.setMediaController(mediaController);
        mVideoView.requestFocus();
        mVideoView.start();

This works fine on my tablet running ICS but doesn't seem to work on GoogleTV, is there something I need to do specifically for GTV in this instance?

Logcat output:

04-30 14:03:41.212: D/MediaPlayer(1132): Couldn't open file on client side, trying server side
04-30 14:03:41.308: D/dalvikvm(1132): GC_CONCURRENT freed 862K, 13% free 8303K/9479K, paused 0ms+2ms
04-30 14:03:51.920: E/MediaPlayer(1132): error (1, -2147483648)
04-30 14:03:51.920: E/MediaPlayer(1132): Error (1,-2147483648)
04-30 14:03:51.920: D/VideoView(1132): Error: 1,-2147483648

回答1:


I verified that VideoView playing YouTube RTSP video works on Google TV:

    String vURL = "rtsp://v5.cache1.c.youtube.com/CjYLENy73wIaLQnhycnrJQ8qmRMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYPj_hYjnq6uUTQw=/0/0/0/video.3gp";

    mVideoView = (VideoView)this.findViewById(R.id.myvideoview);
    mVideoView.setVideoURI(Uri.parse(vURL));
    final MediaController mediaController = new MediaController(this);
    mVideoView.setMediaController(mediaController);
    mVideoView.requestFocus();
    mVideoView.start();

Only thing I changed was parsing a different URL. Try this working URL in your code then.



来源:https://stackoverflow.com/questions/10388535/google-tv-videoview-playing-youtube-rtsp-videos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!