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
Related
Im planning to port old audio play app to andriodx. My app has audio tracks crossfade, gapeless feature implemented using MediaPlayer and VolumeShaper. It's a mandatory functionality for me.
Exoplayer is missing crossfade capability - it has been in the features backlog for many years unfortunately.
Any ideas if there is a way to access MediaPlayer and VolumeShaper from within Exoplayer. Perhaps anyone knows about audio tracks crossfade implementation with Exoplayer?
Thanks in advance!
David
Find a guidance and/or source code sample.
is there anyone who can help me to find a neat coding style in a simple way to set a control in my android app that user can change the quality of video manually. im using exoplayer
im looking for the answer for a while and the demo app is so complicated
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.
I am a newbie on Android development. I wanna quickly to know, in principle, if I can use Media Codec and OpenGL ES to playing a video file? There is no need to think about audio issue. If yes, then I can spent more time to study it. Any suggestions welcome, thank you.
Yup! This is essentially what ExoPlayer does.
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.