How can I change the orientation of a videoview

birnesoft

Active Member
Licensed User
Longtime User
I wan't to change a video between portrait and landscape.
When I change my phone in landscape mode it works fine.
But in portrait mode it change the orientation automaticly.:BangHead:

So how can I controle this by myself in B4A?

thanks Björn
 

pluton

Active Member
Licensed User
Longtime User
I didn't understand the question.

Can you explain more detailed?

If you want that your phone stays in one mode (only landscape or portrait) just in B4A application go to Project -> Orientations Supported and there check what you want.

Both = Landscape/portrait
Landscape = only landscape
Portrait = only portrait
 
Upvote 0

birnesoft

Active Member
Licensed User
Longtime User
I want to be in "portrait only" mode
and change the orientation of a videoview
to look a mp4 in portrait while the phone orientation is also portrait.
 
Upvote 0

ericvanderhoeven

Member
Licensed User
Longtime User
Control orientation of video INSIDE screen's orientation

I want to be in "portrait only" mode
and change the orientation of a videoview
to look a mp4 in portrait while the phone orientation is also portrait.

I think I am facing the same problem = it is 100% clear (to me) how to change the orientation of the entire SCREEN (either by fixing it in the B4A project in general or on the fly via Phone.SetScreenOrientation), but it is not clear how to manipulate the orientation of the video player INSIDE that screen. Call it picture in picture and wanting control over the orientation of a sub picture (the video panel):cool:

This seems to depend on the default setting of the native video player? If I run my code on a phablet (my Samsung note), fixed in the project in portrait mode, the video plays from ''left to right''. If I run the same code on a tablet fixed in portrait mode, the video plays from ''top to bottom'' = on its side, 90 degrees CW..

In general, the concept of why Android felt it was necessary to ''reset'' the main activity when you rotate a device, remains a complete mystery to a :sign0104: like me. Perhaps a good explanation to WHY this is done, will help with understanding..?

I see a lot of threads on this topic, assuming I am not the only one that got completely thrown off track when I rotated my first app and it pulled this stunt.. :sign0148:
 
Upvote 0

ericvanderhoeven

Member
Licensed User
Longtime User
native media player service

While you do have control over the screen orientation, you do not have control over the video orientation. It is handled internally by the native media player service.

Did you see this tutorial: Android Process and activities life cycle

Hi Erel,

I looked at the tutorial and although it contains very useful information about general programming aspects, blunt as I am, I did not find any useful information on how the native media player service is configured in/by the device.

I am sure there must be a method to set it initially somewhere (either in the rom or a settings file). I've discovered over time that portrait based home screen devices (mostly phones) handle this differently to landscape based home screen devices (mostly tablets).

It remains a bit weird that there IS the opportunity to control your app in any orientation possible via programming (the Phone.SetScreenOrientation command or through the IDE in general) and the video play orientation just seems to be fixed.. Doesn't make sense to me. OR does a videoview, when added in the program, simply not ''respect'' the current SetScreenOrientation?

I have no objections to go native (if I knew how) although I am a big fan of B4A and absolutely adore it flexibility and prefer to do all things from this portal.

Would you be able to point me into the right direction to find out how to set this native media player (either initially or -hopefully- on the fly)?

Or am I just not doing it correctly by adding a videoview? At the moment I've got the overall program set to portrait mode only (the option in the IDE) and just initiate a videoview. Or should I use SetScreenOrientation explicitly instead, just before initiating a videoview?

Thanks

Eric
 

Attachments

  • imageview vs videoview.jpg
    imageview vs videoview.jpg
    71.5 KB · Views: 359
Upvote 0

ericvanderhoeven

Member
Licensed User
Longtime User
video view orientation

This seems like an issue with the native VideoView. Google for: android videoview orientation

You will see several related discussions.

Hi Erel,

thanks for your effort in replying. I did Google your suggestion and it showed I am not the only one ''suffering'' from this. It indeed is quite difficult to get to the bottom of this. There seems to be no easy fix (or a fix at all)

The solution is therefore still to be found. I haven't found it.

Thanks,

Eric
 
Upvote 0
Top