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

Expert
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

Expert
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

Expert
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

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

warwound

Expert
Licensed User
Longtime User
I know of no other library that is similar to Vitamio.

Looking at the Vitamio source code i see this method is used to install the libarm.so library:

B4X:
  private static String copyCompressedLib(Context ctx, int rawID, String destName) {
  byte[] buffer = new byte[1024];
  InputStream is = null;
  BufferedInputStream bis = null;
  FileOutputStream fos = null;
  String destPath = null;

  try {
  try {
  String destDir = getLibraryPath();
  destPath = destDir + destName;
  File f = new File(destDir);
  if (f.exists() && !f.isDirectory())
  f.delete();
  if (!f.exists())
  f.mkdirs();
  f = new File(destPath);
  if (f.exists() && !f.isFile())
  f.delete();
  if (!f.exists())
  f.createNewFile();
  } catch (Exception fe) {
  Log.e("loadLib", fe);
  }

  is = ctx.getResources().openRawResource(rawID);
  bis = new BufferedInputStream(is);
  fos = new FileOutputStream(destPath);
  while (bis.read(buffer) != -1) {
  fos.write(buffer);
  }
  } catch (Exception e) {
  Log.e("loadLib", e);
  return null;
  } finally {
  IOUtils.closeSilently(fos);
  IOUtils.closeSilently(bis);
  IOUtils.closeSilently(is);
  }

  return destPath;
  }

Look at the line:

B4X:
is = ctx.getResources().openRawResource(rawID);

is is an InputStream obtained from the android Resource class.

Could that method be updated so that if it fails to find the libarm.so asset, it looks elsewhere in the file system?
Could i make including libarm.so optional, if you do not include it then your app would have to download it from the internet and save it to the device external memory?

Some psuedo code might be:

B4X:
  VitamioVideoView1.LIB_INSTALL_PATH=File.Combine(File.DirRootExternal, "libarm.so")

   If VitamioVideoView1.CheckVitamioLibs Then
     VitamioVideoView1.Initialize("VitamioVideoView1")
     Activity.AddView(VitamioVideoView1, 0, 0, 100%x, 100%y)
     VitamioMediaController1.Initialize("VitamioMediaController1")
     VitamioVideoView1.SetMediaController(VitamioMediaController1)
     VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
     VitamioVideoView1.SetVideoPath("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8")
   End If

So you have to set the path to the downloaded libarm.so file before calling CheckVitamioLibs.
The library method copyCompressedLib would fail to find libarm.so in the apk assets, and check to see if a path to libarm.so has been set.
If set it'd install libarm.so from that path, otherwise installation of the library would fail.

Sounds like a backwards step to me - reverting to how the older versions of Vitamio required a download.

What do you think?

Martin.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
I know of no other library that is similar to Vitamio.


So you have to set the path to the downloaded libarm.so file before calling CheckVitamioLibs.
The library method copyCompressedLib would fail to find libarm.so in the apk assets, and check to see if a path to libarm.so has been set.
If set it'd install libarm.so from that path, otherwise installation of the library would fail.

Sounds like a backwards step to me - reverting to how the older versions of Vitamio required a download.

What do you think?

Martin.


i think i'm losing the thread here. are we still talking about bundle 4 or have you been able to take a look at 4.1? messages 56 & 57 come in sequence, but i get the impression 57 refers to something done before 56...
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
My suggestion in post #63 applies to any version of Vitamio - if i can update the library so that you can compile it without the libarm.so file then would that be useful?

Unfortunately i haven't had time to look at the new version yet.

Martin.
 
Upvote 0
Top