0

I am using a simple webview in my android app, and giving a simple url of youtube video,the problem which i am facing sometime is, the video thumbnail icon appears, when i click on the icon it starts buffering and continuously showing a grey sceen(buffering/ progress bar), and there is no audio or video is there.

But after sometime it again shows the thumbnail icon of that video(it means the video has ended) This problem occurs some times.No video or audio is there, just seeing a grey screen, and it is showing that something is buffering.

I have tested this on the Nexus and Samsung Tab 2.

This is what I've done so far:

webView.setLaysetLayoutParams(new LayoutParams(200,200));
webView.loadUrl(youtubeurl); 
mainLayout.addview(webView);

I am setting webview width and height and x and y position of webView in the parent layout dynamically, and then adding the URL to play inside the webView. The problem is sometimes it is showing a grey screen.

Has anyone had the same problem?

Katana24
  • 8,706
  • 19
  • 76
  • 118
LKY
  • 1
  • 2

2 Answers2

0

google publish Youtube player api in android so that you can play youtube vide easily.

henry4343
  • 3,871
  • 5
  • 22
  • 30
  • Youtube player api doesn't support view over view, my app can contain view over view, and also negative coordinate, so youtube api cant be used in my case, – LKY Jan 21 '14 at 09:33
  • You can also add view in YouTubeBaseActivity. – henry4343 Jan 21 '14 at 09:39
  • yes i tested it also, but it gives error not to support negative X and y position of of this view. – LKY Jan 21 '14 at 09:41
0

Yes. It does, but you have to write more code, not just using WebView, see the following links for more information: WebView and HTML5

How to play a video in a webview with android?

And a working example for Android 2.2 -http://www.tandroid.org/html5webview

Community
  • 1
  • 1
learner
  • 3,092
  • 2
  • 21
  • 33