YouTubePlayerView on a ScrollView - android

First, I'd like to point out that there seems to be a limitation in Android in which having a SurfaceView on a ScrollView doesn't work as you would expect. This is explained here
(VideoView uses a SurfaceView internally so it has this problem). But there seems to be a workaround for VideoView which worked for me.
Now, I also want to use the new YouTube API for Android to display embedded YouTube videos on our Android app. The YouTubePlayerView which implements the embedded video player also presents the problem mentioned above since it uses a SurfaceView as shown below in the hierarchy viewer.
I haven't been able to find a workaround for this problem. Having a YouTubePlayerView on a ScrollView is a fairly common use case for our app (and probably for many others too). I would appreciate any comments on this.

I would like this functionality too, but alas, it seems it is still being implemented by Google.
See here:
https://code.google.com/p/gdata-issues/issues/detail?id=4514
The solution should be to use a TextureView which supports playing videos within a ScrollView. Hopefully YouTube API supports this soon.

Related

VideoView vs SurfaceView - Android

I am going to create InApp Video player which will play the videos from our content server and will also support live streaming. Previously was using third party API.
I am confused about going with SurfaceView or VideoView as I have read that VideoView has more lines of code and will be less efficient. Help needed regarding from where should I start? Also need clarity between both. Yes, I have gone through some questions but still confused.
Thank you in Advance.
Frankly Speaking,
VideoView is the combination of SurfaceView and MediaPlayer,
VideoView = SurfaceView + MediaPlayer
But advantage of using Surfaceview and MediaPlayer separately is that you will have the ability to customize it.
I just used VideoView few days ago in my app. I actually had the same confusion. Since, then I came to know about it. I used VideoView. Here is the link below
Link
Hope it helps

How to play videos in recycler view?

The app crashes when I scroll the recyclerview . I know why this happens . But I don't know how to prevent it . There are very less resources online on how to smoothly play videos in recyclerview . Facebook,instagram has done it.(even though they use react native).But what about the android studio users????..Is there a way to play crash free videos in recyclerview?
NOTE
The app crashes because
VideoView extends SurfaceView, and SurfaceView doesn’t have UI synchronization buffers.If by chance the app doesn't crashes then video that is playing tries to catch up the list when you scroll it. That looks horrible!!
You can use ExoPlayer.
for such complex task,and it also provides much more facilities.
Here is the link.
ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend, and can be updated through Play Store application updates.
For using it,just in Gradle file:
implementation 'com.google.android.exoplayer:exoplayer:2.X.X'
For complete details,you can see the blog about how to use it,and its features,i hope it may be useful to you.
If its not the answer,please ignore the answer.

Capture only a part of the screen with MediaProjection

I need to record only specific view and child views inside that view but to exclude other views on the Activity/Screen. Currently I'm working on one project and a thought that I can solve the problem with MediaProjection API. As I said, I need to record a specific view inside the activity.
I found an answer on similar thread: Capturing a part of the screen
But it said that it is not possible with MediaProjection API.
Does the Google provide other solution or does someone has a similar issue or maybe even some solution to the problem?
Thanks

How does Android Play Store list Applications?

I am trying to list some items in a way very similar to Play Store, currently I am using a Webview and managed to do something similar looking, but performance wise it is very slow.
I'm wondering if Play Store also uses a Webview and gets data from a mobile website like I did, or Play Store uses some sort of widget/view/component to achieve this task, possibly natively. It seems on slow or zero internet connection, the application frames+names are still displayed, and only the images do a lazy load, possibly contributing to much smoother application performance while still capable of listing lots of apps on scrooldown. Here is the Play Store page I'm trying to emulate on my application:
There is a video that explains the theory behind the new Google Play design. No code though. But it is very interesting.
Basically they are using Cards as their main building blocks.
Cards are organized into clusters.
And everythings rests on top of a Canvas.
You can check out the presentation slides here.
Easiest to implement this kind of screen with a GridView Tutorials for using it (there are tons of others too):
http://www.mkyong.com/android/android-gridview-example/
http://www.androidhive.info/2012/02/android-gridview-layout-tutorial/
There is also a GridLayout in Android. The difference between the two components is explained clearly in this post: GridView VS GridLayout in Android Apps

simple android video player

i'm very very new to android/java and am trying to create a basic video player on android.
i have researched all throughout stackoverflow, google, youtube, etc but i really can't seem to find a way to do this..
my goal is to have a listview that shows all the compatible videos on the android device. then, after tapping on one of the items in the listview, the video would play.
i did find some very helpful resources, such as http://www.android-trainer.com/playing-with-videos-from-content-providers-part-3-.html , but this code uses the deprecated method managedquery()
i was then lead to this website: http://mobile.tutsplus.com/tutorials/android/android-sdk_loading-data_cursorloader/comment-page-1/#comment-15832 to find a way around the managedquery() method, but judging from the comments, this tutorial is ridden with bugs... i tried to debug the tutorial but i was hoping someone could give me a clear explanation of what to do...
should i focus on the first link and figure out how to go around the deprecated managedquery() method? if so, how do i go about avoiding the managedquery() method?
or is there another, perhaps simpler, way of creating a video player that can play all the videos in the device?
thank you
Where do you want the list to come from? Are you ok with using the default video player?
Where are the videos stored?
ManagedQuery (and cursorloader) is for traversing through a database. You don't need that.

Categories

Resources