本文介绍了如何显示从谷歌云端硬盘网址在Android视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示视频Android应用程序。我已经搜索在谷歌和低于code发现

I want to show video in android application. I have searched on Google and found below code

VideoView videoView =(VideoView)findViewById(R.id.videoView);

字符串vidAddress =的Cookie / preVIEW;

String vidAddress = "https://docs.google.com/a/user.co.jp/file/d/something..private cookie/preview";

乌里VIDEOURI = Uri.parse(vidAddress);

Uri videoUri = Uri.parse(vidAddress);

的MediaController的MediaController =新的MediaController(本);
  mediaController.setAnchorView(videoView);
  videoView.setMediaController(的MediaController);

MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); videoView.setMediaController(mediaController);

videoView.setVideoURI(VIDEOURI); videoView.start();

videoView.setVideoURI(videoUri); videoView.start();

我已经把上面的code在活动的onCreate方法。

I have placed the above code in onCreate method of activity.

当我运行的应用程序它给错误抱歉,该视频无法播放。

When I run application It gives error "Sorry, this video cannot be played."

日志中显示如下

07-15 13:58:13.110: V/MediaPlayer-JNI(19546): native_setup
07-15 13:58:13.110: V/MediaPlayer(19546): constructor
07-15 13:58:13.125: V/MediaPlayer(19546): setListener
07-15 13:58:13.125: I/MediaPlayer(19546): path is null
07-15 13:58:13.125: D/MediaPlayer(19546): Couldn't open file on client side, trying server side
07-15 13:58:13.140: V/MediaPlayer(19546): setVideoSurfaceTexture
07-15 13:58:13.140: V/MediaPlayer-JNI(19546): setAudioStreamType: 3
07-15 13:58:13.140: V/MediaPlayer(19546): MediaPlayer::setAudioStreamType
07-15 13:58:13.140: V/MediaPlayer(19546): setVideoSurfaceTexture
07-15 13:58:13.140: V/MediaPlayer(19546): prepareAsync
07-15 13:58:16.810: V/MediaPlayer(19546): message received msg=100, ext1=1, ext2=-2147483648
07-15 13:58:16.810: E/MediaPlayer(19546): error (1, -2147483648)
07-15 13:58:16.810: V/MediaPlayer(19546): callback application
07-15 13:58:16.810: V/MediaPlayer(19546): back from callback
07-15 13:58:16.815: E/MediaPlayer(19546): Error (1,-2147483648)
07-15 13:58:16.815: D/VideoView(19546): Error: 1,-2147483648

我能看到浏览器的视频。

I am able to see the video on browser.

上传的视频文件类型MPG,MP4和WMV

Uploaded video file type are mpg, mp4 and wmv

请帮助,如果任何一个有解决方案。

Please help if any one have solution.

感谢

编辑:一些工作后,我才知道,其中一个原因是Android版本4.0.3。上面提到的code正在为样本网址像

仅在4.2.2。
从谷歌文档的URL影片仍然没有工作。我应该怎么做才能发挥它4.0.3

Edit : After some work I came to know that one reason is Android version 4.0.3. Above mentioned code is working for sample url likehttp://download.itcuties.com/teaser/itcuties-teaser-480.mp4only in 4.2.2.Videos from Google docs url still not working. What should I do to play it on 4.0.3

推荐答案

该网址,你要解析URI是不兼容VideoView此here为解决方案。

The url that you parse to Uri is not compatible with VideoView because it just a web url for embed on Iframe in html.Please follow this here for solution.

这篇关于如何显示从谷歌云端硬盘网址在Android视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 12:09