Wednesday, August 10, 2011

Youtube Preview Problem on android webview

Today i met with one problem. Actually i am getting the html data from the server. I am showing that using an webview. The problem is html data contain iframe tags. What it mean you tube videos. But at that position i am getting a black screen with you tube logo at bottom. But for iphone and Black berry directly loading preview.

      So that i tried to find the reason. I read no of forms. But there is no solution. On searching i found on e app with you tube videos. So Problem solved. They are taking the 1st frame of the you tube video and embed that using img tag and if we click on that image then redirect to the player.

      So i also search for getting 1st frame of an webview. The way is like this
                       http://img.youtube.com/vi/VIDEO_ID/#.jpg
Here VIDEO_ID : means every youtube vedio has one id.
                        #  :  0 - default size, 1- fisrst frame thumbnail , 2- second frame thumbnail,  3.....

So what you have to do is in the place of iframe tag did this type modification. Then problem will solved.

For More Details : http://www.reelseo.com/youtube-thumbnail-image/