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
 

RedSun

Member
Licensed User
Longtime User
Hi Erel, thanks for the quick response.

Sorry, I should have explained the code a little better. The code was just my latest attempt.

I had previously tried
B4X:
Activity.AddView(Panel3, 0dip, 0dip,100dip, 100dip)

Panel3.AddView(vv, 0dip, 0dip, Panel3.width, Panel3.height)

I am not too fussed that the video wants to go full screen now, but I do want to have a controller button overlay and would like toast messages, which it will not let me do with videoview on its own as it forces itself on top of everything.

If I use the same code with the vitamob4a library, it allows me to have the video in a panel and have an overlay, but it only crops the video not scales to fit (not a huge issue as fullscreen is not so much of an problem for me now), and as I said before, I would prefer not for users to have to download something else for it to work.


Any help would be appreciated, but I can live with the vitamob4a library if there is no sollution.

Thanks
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
If I use the same code with the vitamob4a library, it allows me to have the video in a panel and have an overlay, but it only crops the video not scales to fit (not a huge issue as fullscreen is not so much of an problem for me now), and as I said before, I would prefer not for users to have to download something else for it to work.

I'll send you a PM with a link to a newer b4a Vitamio library.
This newer version is self contained - no need for your app users to visit the Play Store and download the additional Vitamio plugin.

Martin.
 
Upvote 0

RedSun

Member
Licensed User
Longtime User
Have you tried to enable the MediaController?

Again Erel, thanks for the reply.

With the MediaController enabled, like everything else, the controls are stuck behind the video, the Ouya control pad does allow you to select the controls on the panel, you can hear the clicks as you select different items, you just can't see which control you are on, kind of makes any type of control impossible. I am trying to use keypress actions for the various controls hence the overlay, but it is still something I am learning.

I will send the program to my Galaxy Note to see if it is an issue specific to the Ouya, and will get back to you.

EDIT: Just tried on my Note and it works as intended with normal Video View, so I can only surmise that the issue is not with the programming?

I'll send you a PM with a link to a newer b4a Vitamio library.
This newer version is self contained - no need for your app users to visit the Play Store and download the additional Vitamio plugin.

Martin.
Brilliant, thanks for that, will report back with my progress :)

Obviously with the Vitamio library being self contained my problem has been solved (Many Thanks Martin!!), but obviously the Ouya Fullscreen/Videoview Library issue is still there, so if you have any ideas that you need help testing with Erel I would be more than happy to help.

In the meantime, I am a happy bunny, so now on to the next headache, keypress captures :S

Thank you, both of you.
 
Last edited:
Upvote 0

blong

Active Member
Licensed User
Longtime User
Warwound

Would it be possible to upload the new version of the self contained Viatmio library ?

I and I am sure others would be greatful

Thanks in advance.
:cool:
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Warwound

Would it be possible to upload the new version of the self contained Viatmio library ?

I and I am sure others would be greatful

Thanks in advance.
:cool:

That's a good idea.
I've not yet done so as i've been too busy - and uploading a new library and answering all requests for help can get very time consuming.

I have to spend a day or two reinstalling Windows on my desktop PC so will get that done and then upload the Vitamio library.

Martin.
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Thanks Martin !! in expectation of the new library....

Sent you a small donation ... buy a big frothy beer !
 
Upvote 0

RedSun

Member
Licensed User
Longtime User
Hi Erel, Hi Martin,

I ran the test program that came with the updated Vitamio library thanks. Is there any way to improve the quality further than;
.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH) ?

With that setting alone, the Vitamio output is of worse quality than the standard videoview output, at least for me testing on the Ouya.

Below is the demo code I used, amended to include a comparison with VideoView. (changed by menu button)

B4X:
#Region Module Attributes
    #FullScreen: True
    #IncludeTitle: False
    #ApplicationLabel: VitamioBundle demo
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

'Activity module
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub
Sub Globals
    Dim VitamioMediaController1 As VitamioMediaController
    Dim VitamioVideoView1 As VitamioVideoView
    Dim VV As VideoView
    Dim VitOn As Int
    Dim Overlay As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
    '    check if the VitamioBundle core is installed
    '    if this is the first time that the installed application has been started then the core will NOT be installed
    '    otherwise the core should be already installed
   
    '    if the core is NOT installed then CheckVitamioLibs returns False and this Activity's Finish method is called by the library
    '    the core is then installed and this Activity will be restarted
    '    CheckVitamioLibs will now return True and you can proceed to use the library
    If VitamioVideoView1.CheckVitamioLibs Then
   
        VitamioVideoView1.Initialize("VitamioVideoView1")
        Activity.AddView(VitamioVideoView1, 5%x, 5%y, 90%x, 90%y)
       
        VitamioMediaController1.Initialize("VitamioMediaController1")
       
        VitamioVideoView1.SetMediaController(VitamioMediaController1)
        VitamioVideoView1.SetVideoPath("http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sver=3&expire=1374248116&itag=22&id=ad4b57f29165e967&upn=8gOITPaVVjM&cp=U0hWSVJPVl9GUENONl9KSVpCOjlpS3VzYjhtbHBt&sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1374226349&mv=m&source=youtube&ms=au&ratebypass=yes&ipbits=8&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,904830,919373,904122,908534,936303,909549,900816,912711,935000,921057,929309&key=yt1&ip=90.210.142.0&signature=D73749669A867FA322383BFFA084F2146BEBE582.D1B502EC0FD3764F00A323507AF01274B5109A21")
        VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
    End If
    VitOn=1
    Overlay.Initialize("overlay")
    Activity.AddView(Overlay, 50dip, 50dip, 40dip, 40dip)
    Overlay.Color = Colors.ARGB (100, 200, 200, 200)
   
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
    If VitamioVideoView1.IsPlaying Then
        VitamioVideoView1.StopPlayback
    End If
End Sub
Sub VitamioVideoView1_Buffering(Percent As Int)
    '    Log("VitamioVideoView1_Buffering: "&Percent)    '    commented out to avoid unless logging
End Sub
Sub VitamioVideoView1_Complete
    Log("VitamioVideoView1_Complete")
End Sub
Sub VitamioVideoView1_Error(MEDIA_ERROR As Int) As Boolean
    '    this event Sub must return a Boolean value to indicate whether it has handled the error or not
    '    returning True will prevent the library from taking any action such as displaying an error message
    Log("VitamioVideoView1_Error")
   
    Return True
End Sub
Sub VitamioVideoView1_Info(What As Int, Extra As Int) As Boolean
    '    what does this event mean?
    '    what do the Int parameters represent?
   
    '    Log("VitamioVideoView1_Info")    '    commented out to avoid unless logging
    Return False    '    indicates that this Sub has NOT handled the event and that the library should handle it
End Sub
Sub VitamioVideoView1_Prepared
    Log("VitamioVideoView1_Prepared")
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
    If KeyCode = KeyCodes.KEYCODE_MENU Then
        If VitOn=1 Then
        VitamioVideoView1.StopPlayback
        VitamioVideoView1.RemoveView
        VV.Initialize("vv")
        Activity.AddView(VV, 5%x, 5%y, 90%x, 90%y)
        VV.LoadVideo("http", "http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sver=3&expire=1374248116&itag=22&id=ad4b57f29165e967&upn=8gOITPaVVjM&cp=U0hWSVJPVl9GUENONl9KSVpCOjlpS3VzYjhtbHBt&sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1374226349&mv=m&source=youtube&ms=au&ratebypass=yes&ipbits=8&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,904830,919373,904122,908534,936303,909549,900816,912711,935000,921057,929309&key=yt1&ip=90.210.142.0&signature=D73749669A867FA322383BFFA084F2146BEBE582.D1B502EC0FD3764F00A323507AF01274B5109A21")
        VV.play
        VitOn=2
        Else
        VV.Stop
        VV.RemoveView
        If VitamioVideoView1.CheckVitamioLibs Then
            VitamioVideoView1.Initialize("VitamioVideoView1")
            Activity.AddView(VitamioVideoView1, 5%x, 5%y, 90%x, 90%y)
            VitamioMediaController1.Initialize("VitamioMediaController1")
            VitamioVideoView1.SetMediaController(VitamioMediaController1)
            VitamioVideoView1.SetVideoPath("http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sver=3&expire=1374248116&itag=22&id=ad4b57f29165e967&upn=8gOITPaVVjM&cp=U0hWSVJPVl9GUENONl9KSVpCOjlpS3VzYjhtbHBt&sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1374226349&mv=m&source=youtube&ms=au&ratebypass=yes&ipbits=8&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,904830,919373,904122,908534,936303,909549,900816,912711,935000,921057,929309&key=yt1&ip=90.210.142.0&signature=D73749669A867FA322383BFFA084F2146BEBE582.D1B502EC0FD3764F00A323507AF01274B5109A21")
            VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
            VitOn=1
            End If
        End If
    End If
End Sub

I included a small panel to overlay the video.

Now on my Ouya with that code and settings, the video on the Vitamio output has gradient banding, stutters slightly, has audio sync issues in places, etc.
Whereas the videoview output is perfect and looks more detailed, but as my original post, videoview goes forced fullscreen so the small panel overlay, along with everything else, is hidden from view.

If you could test it and let me know if there is anyway to improve the video quality results that would be much appreciated.

Thanks for any help.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Can you test the exact same code on a different android device - a mobile or tablet - and see if the problem is the quality of the video being viewed or something to do with the Ouya?

Martin.
 
Upvote 0

RedSun

Member
Licensed User
Longtime User
Hi Martin,

Just tested on my Galaxy Note and it is the same, the Vitamio output has a quality issue compared to the videoview output.

-Small stuttering in places.
-Gradient Banding/Blocky

I will see if I can screenshot the differences and upload them.

EDIT: It seems that trying to screenshot the videoview output just gives a black screen
 
Last edited:
Upvote 0

RedSun

Member
Licensed User
Longtime User
Well, I couldn't get a screenshot from videoview, so I took a screenshot from the youtube original (which comes out looking the same in videoview) to show you the difference.

Vitamio Screenshot
qs5w90.png


Youtube Screenshot (Same quality as videoview)
2hed91c.png


Notice the blocky gradient banding of the clouds/mist compared to the original.

In some places it looks worse.
 
Last edited:
Upvote 0

moster67

Expert
Licensed User
Longtime User
Hmm...can you post the URL-link you used above for testing. Just want to make a test for myself. Thanks.
 
Upvote 0

RedSun

Member
Licensed User
Longtime User
At the moment I am using a decoded direct link to a youtube video; (For ease of use while testing only)
www.youtube.com/watch?v=rUtX8pFl6Wc
(The 720p mp4 version)

I will post the decoded URL, but as they are timed session based (and looking at the link ip based too) it would probably be invalid by the time you read this.
B4X:
http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&id=ad4b57f29165e967&key=yt1&cp=U0hWSVNLU19GUENONl9LRVdIOjlpS3VzYzRqcnBt&upn=UUHy5OPmdvA&ms=au&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,931917,904830,919373,904122,908534,919387,936303,909549,900816,936301,912711,935000,921057,929309&source=youtube&sver=3&itag=22&ratebypass=yes&mv=m&expire=1374305716&ip=90.212.81.34&mt=1374284048&ipbits=8&signature=4FCFED9B80DD3FC948C558D52D21C4321B4FD908.8A74C392E557C3E0A263E780C84DBEFAF51E8002

Both libraries access that link and give the results above.

I think tomorrow I will try running the program with the mp4 locally on the memory, obviously this changes too many variables to be able to eliminate much as the problem, but if the results are the same, we will know it is not an issue between the youtube link and the Vitamio library.

EDIT: I have found some test direct links to some small video clips that might be a better test, will try tomorrow. :)
 
Last edited:
Upvote 0

RedSun

Member
Licensed User
Longtime User
Hi Martin.

Just tested with the new video and the problems are still there (gradient banding, audio skipping, etc), I will post the code for you to try below.

Video Link:
http://www.auby.no/files/video_tests/h264_720p_mp_3.1_3mbps_aac_shrinkage.mp4

B4X:
#Region Module Attributes
    #FullScreen: True
    #IncludeTitle: False
    #ApplicationLabel: VitamioBundle demo
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

'Activity module
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub
Sub Globals
    Dim VitamioMediaController1 As VitamioMediaController
    Dim VitamioVideoView1 As VitamioVideoView
    Dim VV As VideoView
    Dim VitOn As Int
    Dim Overlay As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
    '    check if the VitamioBundle core is installed
    '    if this is the first time that the installed application has been started then the core will NOT be installed
    '    otherwise the core should be already installed

    '    if the core is NOT installed then CheckVitamioLibs returns False and this Activity's Finish method is called by the library
    '    the core is then installed and this Activity will be restarted
    '    CheckVitamioLibs will now return True and you can proceed to use the library
    If VitamioVideoView1.CheckVitamioLibs Then

        VitamioVideoView1.Initialize("VitamioVideoView1")
        Activity.AddView(VitamioVideoView1, 5%x, 5%y, 90%x, 90%y)

        VitamioMediaController1.Initialize("VitamioMediaController1")

        VitamioVideoView1.SetMediaController(VitamioMediaController1)
        VitamioVideoView1.SetVideoPath("http://www.auby.no/files/video_tests/h264_720p_mp_3.1_3mbps_aac_shrinkage.mp4")
        VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
    End If
    VitOn=1
    Overlay.Initialize("overlay")
    Activity.AddView(Overlay, 50dip, 50dip, 40dip, 40dip)
    Overlay.Color = Colors.ARGB (100, 200, 200, 200)

End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
    If VitamioVideoView1.IsPlaying Then
        VitamioVideoView1.StopPlayback
    End If
End Sub
Sub VitamioVideoView1_Buffering(Percent As Int)
    '    Log("VitamioVideoView1_Buffering: "&Percent)    '    commented out to avoid unless logging
End Sub
Sub VitamioVideoView1_Complete
    Log("VitamioVideoView1_Complete")
End Sub
Sub VitamioVideoView1_Error(MEDIA_ERROR As Int) As Boolean
    '    this event Sub must return a Boolean value to indicate whether it has handled the error or not
    '    returning True will prevent the library from taking any action such as displaying an error message
    Log("VitamioVideoView1_Error")

    Return True
End Sub
Sub VitamioVideoView1_Info(What As Int, Extra As Int) As Boolean
    '    what does this event mean?
    '    what do the Int parameters represent?

    '    Log("VitamioVideoView1_Info")    '    commented out to avoid unless logging
    Return False    '    indicates that this Sub has NOT handled the event and that the library should handle it
End Sub
Sub VitamioVideoView1_Prepared
    Log("VitamioVideoView1_Prepared")
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
    If KeyCode = KeyCodes.KEYCODE_MENU Then
        If VitOn=1 Then
        VitamioVideoView1.StopPlayback
        VitamioVideoView1.RemoveView
        VV.Initialize("vv")
        Activity.AddView(VV, 5%x, 5%y, 90%x, 90%y)
        VV.LoadVideo("http", "http://www.auby.no/files/video_tests/h264_720p_mp_3.1_3mbps_aac_shrinkage.mp4")
        VV.play
        VitOn=2
        Else
        VV.Stop
        VV.RemoveView
        If VitamioVideoView1.CheckVitamioLibs Then
            VitamioVideoView1.Initialize("VitamioVideoView1")
            Activity.AddView(VitamioVideoView1, 5%x, 5%y, 90%x, 90%y)
            VitamioMediaController1.Initialize("VitamioMediaController1")
            VitamioVideoView1.SetMediaController(VitamioMediaController1)
            VitamioVideoView1.SetVideoPath("http://www.auby.no/files/video_tests/h264_720p_mp_3.1_3mbps_aac_shrinkage.mp4")
            VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
            VitOn=1
            End If
        End If
    End If
End Sub

You can switch between libraries with the MENU button.

EDIT: Confirmed, same results on my Note, screenshot comparison results below.
All shots taken from my Note (I managed to find a screenshot type that would capture videoview stills)

The stills only portray the gradient banding, the Vitamio playback started having stuttering problems whereas the videoview playback had no problems at all.

The Vitamio shots have the grey square overlay in the top left corner.

34tcsid.png

dphbvt.png

10erex3.png

keaeex.png

28k35f7.png

msgos0.png


The explosion flames probably give the best indication, but the difference is fairly obvious during playback.

Hope this helps eliminate the youtube link as a possible spanner in the works.
 
Last edited:
Upvote 0

moster67

Expert
Licensed User
Longtime User
As far as I know, there is nothing you as a developer can change to improve the quality unless version 4 has something new to offer (maybe hardware-decoding). I recall no other APIs to wrap.

You have 3 options: 16 (High), 0 (medium) or -16 (low)
You can use vv.SetVideoQuality(16) as well

Try to toggle between qualities once the file is being shown (start high, then medium, then low and then back to high. I have noted that sometimes the vitamio-library improves quality after a while (maybe a buffering issue) although I have only tested with streaming.
 
Upvote 0

RedSun

Member
Licensed User
Longtime User
As far as I know, there is nothing you as a developer can change to improve the quality unless version 4 has something new to offer (maybe hardware-decoding). I recall no other APIs to wrap.

You have 3 options: 16 (High), 0 (medium) or -16 (low)
You can use vv.SetVideoQuality(16) as well

Try to toggle between qualities once the file is being shown (start high, then medium, then low and then back to high. I have noted that sometimes the vitamio-library improves quality after a while (maybe a buffering issue) although I have only tested with streaming.

Hi Moster, thanks for the quick response.

The high quality setting is already set in the code above;
B4X:
VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
But I will try changing the quality settings to med/low.

Does the Vitamio library allow quality changes during playback?
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Does the Vitamio library allow quality changes during playback?

Yes it does if I remember correctly. That's why I said to try toggling quality during playback.

Something like this (here I am using an Action menu - pls disregard):

B4X:
Dim action As AHActionItem
    action = ac2.getActionItem(Position)
    DoEvents

    If action.ActionId = 1 Then
        vv.setVideoQuality(16) 'High
        ToastMessageShow("Video Quality is now High.", False)
    Else If action.ActionId = 2 Then
        vv.setVideoQuality(0) 'Medium
        ToastMessageShow("Video Quality is now Medium.", False)
    Else If action.ActionId = 3 Then
        vv.setVideoQuality( - 16) 'Low
        ToastMessageShow("Video Quality is now Low.", False)
    End If
 
Upvote 0
Top