Video View Fullscreen And On Top On Ouya

RedSun

Member
Licensed User
Longtime User
Is there any way to force the video view to not be fullscreen and on top?

I am creating a program on the Ouya and I want a controls overlay on top of the video playback, but the video always goes fullscreen and forces itself on top of everything else, even toast messages do not appear.

I have tried the videoviewextras, and vvelib libraries. The aspect ratio could be changed, but it still forced its way into fullscreen.

It works if I use vitamob4a library, but I would like for users not to have to download anything extra if possible as I would think that may put a lot of people off.

I am kind of thinking this may be an Ouya specific issue.

New to all this, so I am probably missing something obvious, but any help would be appreciated.

B4X:
vv.MediaControllerEnabled=False
Activity.AddView(Panel3, 0dip, 0dip, Activity.width, Activity.height)
Panel3.AddView(vv, 0dip, 0dip, Panel3.width, Panel3.height)
vv.LoadVideo("http", "videofile location")
vv.Play
Activity.AddView(Panel2, 400dip, 400dip, 60dip, 60dip)
Panel2.AddView(ImageView3, 0dip, 0dip, 60dip, 60dip)
ImageView3.Bitmap = LoadBitmap(File.DirAssets, "ouya_o.png")
ImageView3.Gravity=Gravity.fill
Panel2.BringToFront
ImageView3.BringToFront
 

drgottjr

Well-Known Member
Licensed User
Longtime User
@drgottjr

I've now fixed the compilation problems that was causing the UnsatisfiedLinkError.
Can you download the library again and test?
Download link is the same as before: http://android.martinpearman.co.uk/b4a/temp/VitamioBundle4_library_files_20130725.zip.

Thanks.

Martin.

yesss!
sound choppy - ie, basically white noise - on emulator (to be expected, i suppose), but no errors. only friendly log posts.
deployed to device (nexus with latest 4.3). left old vitamio dll(s) in place, as i was afraid if i uninstalled even for 5 minutes, the great google would have removed vitamio from download site "for my country". even so, bundle4 example initialized and ran without errors; sound and video perfect to my ancient organs. only problem, the control thingie didn't work. i don't use the controller (i just have start and stop buttons for user), so i'm not familiar with it. anyway, on emulator, i see the controller lets you pause the video. on device i can only see the time elapsed part of the controller along bottom of screen. so no way to stop video. in any case, i wanted to report that the thing runs. others can look into the controller issue; i want to see if i can start/stop a video programatically. also, i'm going to plug in my links to live video/audio feeds, which is what my app uses. fingers crossed. and good job.
-go
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
Longtime User
yesss!
sound choppy - ie, basically white noise - on emulator (to be expected, i suppose), but no errors. only friendly log posts.
deployed to device (nexus with latest 4.3). left old vitamio dll(s) in place, as i was afraid if i uninstalled even for 5 minutes, the great google would have removed vitamio from download site "for my country". even so, bundle4 example initialized and ran without errors; sound and video perfect to my ancient organs. only problem, the control thingie didn't work. i don't use the controller (i just have start and stop buttons for user), so i'm not familiar with it. anyway, on emulator, i see the controller lets you pause the video. on device i can only see the time elapsed part of the controller along bottom of screen. so no way to stop video. in any case, i wanted to report that the thing runs. others can look into the controller issue; i want to see if i can start/stop a video programatically. also, i'm going to plug in my links to live video/audio feeds, which is what my app uses. fingers crossed. and good job.
-go


quick update to previous: links to several live feeds went well. tried as best i could to compare performance between a given stream on bundle4 and "same" stream under v3 wrapper. not scientifically valid, but seemed to be fine. will add stop button and roll out my full array of feeds.

side note: i deployed bundle4 to my old winmo hd2 which now runs ics. things started off well, controller was actually visible for a second, but system starting struggling after about 30 seconds and example failed. by way of comparison, the hd2 runs v3 wrapper without problem. won't even speculate what could be going on there, except to say that v3 may be happier with less power/memory.
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
Longtime User
quick update to previous: links to several live feeds went well. tried as best i could to compare performance between a given stream on bundle4 and "same" stream under v3 wrapper. not scientifically valid, but seemed to be fine. will add stop button and roll out my full array of feeds.

side note: i deployed bundle4 to my old winmo hd2 which now runs ics. things started off well, controller was actually visible for a second, but system starting struggling after about 30 seconds and example failed. by way of comparison, the hd2 runs v3 wrapper without problem. won't even speculate what could be going on there, except to say that v3 may be happier with less power/memory.


further update:
a stop button works
a pause button works
a start button works after "pause". does not work after "stop"
bundle4.png
 
Upvote 0

Andrew Pye

New Member
Licensed User
Longtime User
Hi

I have been writing a app that uses the version 3 of you vitamio lib and been struggling with the video resizing to the full screen and not the panel i have added it to.
so i thought i would see if your new version would work but it seems thought it does the same.
I have tried setting the size of the video view it ok until the video starts playing it just resizes to the full with of the screen.
Is it possible to set the max width and height of the video and it will size to that or am i missing something.

any help would be appreciated.

Andrew
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Let me start by saying i'm not a user of this library - just the developer.
Looking back through this thread i thought that others had successfully displayed the VitamioVideoView sized so that it was less than full screen.

But testing the demo code i see that once a video starts playing, the VitamioVideoView is likely to expand to fully display the video.
The VitamioVideoView Top and Left will remain as originally set but the Width and Height will adjust to the video size.

In the demo project i modified the line that adds the VitamioVideoView to the Activity:

B4X:
Activity.AddView(VitamioVideoView1, 20dip, 30dip, 100%x-40dip, 100%y-60dip)

Next i modified the 'Prepared' Sub:

B4X:
Sub VitamioVideoView1_Prepared
   Log("VitamioVideoView1_Prepared")
   VitamioVideoView1.SetLayout(20dip, 30dip, 100%x-40dip, 100%y-60dip)
   VitamioVideoView1.SetVideoLayout(VitamioVideoView1.VIDEO_LAYOUT_SCALE, 0)
End Sub

Trying to call SetVideoLayout in Activity_Create caused a null pointer exception so i thought calling it once the video was 'prepared' would be enough to force it to scale it's size as desired.
But it made no difference - the video expands rather than scales down in size.

Hopefully some other members can help...

Martin.
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
Hi Martin,

Can we play video with subtitle yet?
 
Upvote 0

Andrew Pye

New Member
Licensed User
Longtime User
Let me start by saying i'm not a user of this library - just the developer.
Looking back through this thread i thought that others had successfully displayed the VitamioVideoView sized so that it was less than full screen.

But testing the demo code i see that once a video starts playing, the VitamioVideoView is likely to expand to fully display the video.
The VitamioVideoView Top and Left will remain as originally set but the Width and Height will adjust to the video size.

In the demo project i modified the line that adds the VitamioVideoView to the Activity:

B4X:
Activity.AddView(VitamioVideoView1, 20dip, 30dip, 100%x-40dip, 100%y-60dip)

Next i modified the 'Prepared' Sub:

B4X:
Sub VitamioVideoView1_Prepared
   Log("VitamioVideoView1_Prepared")
   VitamioVideoView1.SetLayout(20dip, 30dip, 100%x-40dip, 100%y-60dip)
   VitamioVideoView1.SetVideoLayout(VitamioVideoView1.VIDEO_LAYOUT_SCALE, 0)
End Sub

Trying to call SetVideoLayout in Activity_Create caused a null pointer exception so i thought calling it once the video was 'prepared' would be enough to force it to scale it's size as desired.
But it made no difference - the video expands rather than scales down in size.

Hopefully some other members can help...

Martin.

Hi Martin,

Thanks for your help


I had a look throught the source of the https://github.com/yixia/VitamioBundle

found the layout code

I looks like it gets the display size and not the parent

B4X:
 public void setVideoLayout(int layout, float aspectRatio) {
    LayoutParams lp = getLayoutParams();
    DisplayMetrics disp = mContext.getResources().getDisplayMetrics();
    int windowWidth = disp.widthPixels, windowHeight = disp.heightPixels;
    float windowRatio = windowWidth / (float) windowHeight;
    float videoRatio = aspectRatio <= 0.01f ? mVideoAspectRatio : aspectRatio;
    ...

So i created a new function setVideoLayout2(int layout, float aspectRatio,int viewWidth ,int viewHeight)

and changed
int windowWidth = disp.widthPixels, windowHeight = disp.heightPixels;
to
int windowWidth = viewWidth, windowHeight = viewHeight;

then compile it up but then realized this is futile because i can't change the wrapper code to add the wrapper for setVideoLayout2 ;o(

so just to test i hacked the line in the setVideoLayout and complied and rebuilt the VitamioBundle4.jar
but the video would not play not sure if the wrapper would need to be complied with the modified VitamioBundle code

Bit at a loss now ;o(

Cheers Andrew
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Hi susu.

I'm still waiting for moster to do a bit of research and get back to me on this.

Martin.

OK, it works. I tested using a local video mp4-file with its corresponding srt-file:

in the Sub VitamioVideoView1_Prepared, add the following code:


B4X:
VitamioVideoView1.AddTimedTextSource(File.Combine(File.DirRootExternal, "Continuum2x11.srt"))
VitamioVideoView1.SetTimedTextShown(True)

then just do what you want with the SubText appearing in the Sub
B4X:
VitamioVideoView1_TextSubtitleUpdated(SubText As String)

example:

B4X:
Sub VitamioVideoView1_Prepared
    Log("VitamioVideoView1_Prepared")
    VitamioVideoView1.AddTimedTextSource(File.Combine(File.DirRootExternal, "Continuum2x11.srt"))
    VitamioVideoView1.SetTimedTextShown(True)
End Sub

Sub VitamioVideoView1_TextSubtitleUpdated(SubText As String)
    Log(SubText) 'show SubText in a label or something similar
End Sub

Tip: I haven't tested but it might be better to make sure that the subtitle-file has the same name as the video-file. Example:

my video-file: Continuum2x11.mp4
my srt-file: Continuum2x11.srt

Hope that helps.
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
Hi Mike & Martin,

I tried Martin's example with lastest Vitamio library but there's no seekbar when playing video. I tested on Android 4.1.2 and 4.2.2 with the same result. Could you please check it?

Thank you so much.

screenshot.png
 
Upvote 0

androh

Member
Licensed User
Longtime User
Upvote 0

warwound

Expert
Licensed User
Longtime User
Could you update library to 4.1.1?

If that update is just a bug-fix then it should be backwards compatible with the existing b4a wrapper library.

Can you download version 4.1.1 of Vitamio, rename it to VitamioBundleNative.jar and copy it to your b4a additional libraries folder - over-writing the existing (older version) VitamioBundleNative.jar?

Post with your results - if it works then no doubt everyone ought to update to this new version.
If it doesn't work can you post error logs so i can see what needs to be changed to make it work?

Thanks.

Martin.
 
Upvote 0

androh

Member
Licensed User
Longtime User
Can you download version 4.1.1 of Vitamio, rename it to VitamioBundleNative.jar and copy it to your b4a additional libraries folder - over-writing the existing (older version) VitamioBundleNative.jar?
.

Hi Martin,
Vitamio.jar file was deleted. (I can't found vitamiobundlenative.jar)
https://github.com/yixia/VitamioBundle/commit/0fea33f9776f32f3300ae45cd44c0c89e14e12ea

I tried this steps:
#1 Only change libarm.so file.
Error from log: Native libs libOMX.16.so not exists!
#2 Built vitamio library. I saw initactivity.jar (from new vitamio lib: ınitactivity.jar) was like VitamioBundle4.jar (from you lib files). Files was updated from initactivty.jar to vitamobundle4.jar.
Error from log: java.lang.NoClassDefFoundError: io.vov.vitamio.R$string

What else can I try?
Thanks.​
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
The update isn't compatible with the existing b4a wrapper - i shall need to take some time this weekend to download the update and see what needs to be done to make it compatible.

I'll keep this thread updated.

Martin.
 
Upvote 0

androh

Member
Licensed User
Longtime User
The update isn't compatible with the existing b4a wrapper - i shall need to take some time this weekend to download the update and see what needs to be done to make it compatible.

I'll keep this thread updated.

Martin.

Thanks Martin,
I look forward to hearing from you soon.
 
Upvote 0

Rick Harris

Well-Known Member
Licensed User
Longtime User
Right, i have updated the library so it now wraps Vitamio version 4 and is ready for testing.

I just tried a test using RedSun's video link from post #17 in this thread.
On my 7" Galaxy Tab2 it looked pretty impressive - certainly no playback problems and in my opinion the quality was very good too.
(I must admit i didn't have time to view the same video using the Vitamio version 3 library).

Anyway let's see what results other get on different devices...

First you'll need version 4 of the b4a Vitamio library: SEE POST #26 FOR LINK.

Then the example b4a project: http://android.martinpearman.co.uk/b4a/temp/VitamioBundle4_alpha_example_project.zip, 7.44MBs in size.

The b4a project contains all the res folder contents that are also in the library download - that's why it's a massive 7.44MBs in size.

There's a few syntax changes to note from version 3, but as there's only a handful of b4a users that had access to version 3 that shouldn't be a problem.

The main changes are with the methods that handled sub-titles, version 4 of Vitamio calls sub-titles timed text.
moster might note i've changed the VitamioVideoView GetLayout method to GetVideoLayout so it better matches it's corresponding SetVideoLayout method.
Finally VitamioVideoView has a new method SetVideoChroma(Chroma As Int).

So if you'd like to give it a test and post your results, once we're all happy with it i'll properly release it to all forum members.

Martin.
 
Upvote 0

Rick Harris

Well-Known Member
Licensed User
Longtime User
Martin, I love your vitamiobundle4 library. It works extremely well.
However, I tried to integrate it in one of my own large apps (20MB+) (in stead of using videoview and mediaplayerstream), but the combination simply becomes too large and the App crashes (Out of Memory errors).
Is there any way to reduce the size of vitamiobundle4? 8 MB is simply too much. What parts can maybe be omitted?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Looking at the library files, most of that 8MBs is the res folder at 7.45MBs.

The res folder contains many XML and PNG files, but the bulk of it's size is made up of the file raw/libarm.so which is 7.3MBs.
When your app is compiled, most contents of the res folder are compressed and added to the apk.
BUT the contents of the raw folder are (i think) not compressed.
libarm.so is actually an already compressed file - when you app first runs and installs the vitamio framework, libarm.so is uncompressed and installed.

So it's this libarm.so file that makes the vitamio library so large and it's an essential part of the library.
On top of that it cannot be compressed like other resource files.

I'd say the answer to your question is unfortunately NO, there's no way to reduce the size of the files required in order to use vitamio :(.

Martin.
 
Upvote 0

Rick Harris

Well-Known Member
Licensed User
Longtime User
Looking at the library files, most of that 8MBs is the res folder at 7.45MBs.

The res folder contains many XML and PNG files, but the bulk of it's size is made up of the file raw/libarm.so which is 7.3MBs.
When your app is compiled, most contents of the res folder are compressed and added to the apk.
BUT the contents of the raw folder are (i think) not compressed.
libarm.so is actually an already compressed file - when you app first runs and installs the vitamio framework, libarm.so is uncompressed and installed.

So it's this libarm.so file that makes the vitamio library so large and it's an essential part of the library.
On top of that it cannot be compressed like other resource files.

I'd say the answer to your question is unfortunately NO, there's no way to reduce the size of the files required in order to use vitamio :(.

Martin.
 
Upvote 0
Top