I need to play multiple video on screen using Open Gl ES 2.0 in Android. I have the code of playing a single video. For playing 3 videos I have used three 3 views with 3 videos. However there are issues related to performance when playing 3 videos (there is flickering on the screen at times or video stuck issue). So I wanted to know if there is better way of playing multiple video using Open Gl
When I played those 3 video using VideoView without using Open Gl, they are playing fluently. Even with 4 videos it worked well.
https://code.google.com/p/android/issues/detail?id=36742
I have solved the issued from the above link. It says why the flickering of video occurs when displaying a video with texture view.
Thanks all.
Related
I am trying to make an app where users post videos and see the posted videos in a feed ( like facebook). It all works. I am using cameraview for capturing video and Exoplayer for playing it. It works fine but the issue is that if video is posted by a device different than the device playing it then the video is not taking the full width of the screen.I guess it depends on the aspect ration/resolution of the video being posted.
How do I overcome this problem? How do apps like fb and instagram ensure the video is playing in the same area on all devices without cropping/stretching it
Thank you
In my app, I use several independent VideoViews in order to buffer videos one after another while only one video is playing at the same time.
I observed that when one video is playing and I call VideoView.setVideoURI on a VideoView in the background in order to start buffering, the currently visible video will suddenly be cropped to the dimensions of the video that is loading in the background.
I assume that this is a low-level bug within the Android system which will crop the existing video rendering layer as soon as there's new video data available, even if both videos and VideoViews are actually independent.
Has anybody also noticed this behaviour and knows a workaround?
Thanks!
I've an app that uses a Native Activity as it is mostly C++ code (cross platform).
I also need to play Video and Audio so have another Activity that uses MediaPlayer to play video and/or audio. This is used in conjunction with the Native Activity to play Video in front of the OpenGL rendered application.
The MediaPlayer activity is based upon that in the ApiDemos example, and works fine on MOST devices (Nexus 7/10, Galaxy S3/Tab2, even some low-cost devices like Fusion5).
BUT running it on a low-cost Scroll Plus 7" tablet - the code functions, but no Video is displayed.
The Audio plays, the Video Controls show and are usable.
NOTE: I have actually been able to hack with the code to get the Video showing - though this is not a solution it may help someone identify the problem.
In my Native Code where the Open Gl render calls eglSwapBuffers, if I comment this line out the Video shows. (I complete the rendering in a loop inside android_main)
Obviously this means my OpenGL Rendering that needs to go on in the background stops working, so I cannot fix it this way.
Device:
Scroll Plus
7" TABLET by Storage Options
Jelly Bean 4.1
From LogCat i believe it is running a CedarX-based Media Decoder/Renderer.
After 4 days on this issue, I've finally found out that the Video was being drawn BEHIND my OpenGL. Why only on this device I don't know. All the other aspects of the Video Activity (the controls etc) are in front where it should be.
The eglSwapBuffers was a red-herring, in that case I was not drawing anything to the screen.
I’m trying to achieve the following:
Play a long video from the web using a VideoView
In Parallel buffer a short video from the Web
After X Seconds, pause the long video and Play the short one
When done playing the short video, I resume the long video
I need the transition between movies will be as smooth as possible
I’ve tried to achieve this by several methods using ICS:
Use two VideoViews on top of each other and toggle between them, but I had Z-ordering issues
I’ve took the code of VideoView and modify it to have another MediaPlay inside it to buffer and play the short movie
Option number 2 works on ICS, but when trying on Android 2.3 it failed to work, I’ve read that having two MediaPlay objects running in the same time is not guaranteed to work.
My question is how can this be achieved using Android 2.1 or higher?
The option 1 is never a possiblity as you can not have two SurfaceViews/VideoView z ordered on the same screen.
PFB the link which states the same thing:
Handling two surfaceViews
I just came across the limitation of VideoView of not being able to play mp4 video files that are wider than 320 pixels. I was wondering how can we overcome these limitations. I am trying to make my app as forgiving as possible, so other than using VideoViews is there another way to play these mp4 videos?
Chris
I am not aware of a 320px wide limit on VideoView, though I haven't tried it.
You can use MediaPlayer and a SurfaceView to play back videos. In fact, that's pretty much all VideoView is. Last I looked at the VideoView source code, it was only ~200 lines.
Here is a sample project that implements a video player using MediaPlayer and SurfaceView, with screen taps to bring up some pop-up panels (e.g., timeline).