Saideep Kankarla
Saideep Kankarla

Reputation: 423

Force video to play in Landscape mode in android app using phonegap

i'm creating a android app in phonegap its orientation is in Portrait mode

i'm using HTML5 video tag to play videos in tablet pc

but coming to the videos it should be play in Landscape mode.

How can I do that?

Please help me in solving this as im new to phonegap

Thanks

Upvotes: 1

Views: 1866

Answers (2)

DaveAlden
DaveAlden

Reputation: 30356

You can change the orientation mode in an Android Phonegap app using this plugin. The version on GitHub is out-of-date and doesn't work with recent versions of Phonegap but I have updated it - you can find the source code in my answer to this question or download my Eclipse test project which includes the updated code.

You should be able to use the plugin to set your app into landscape mode on playing a video:

cordova.require('cordova/plugin/screenorientation').set("landscape");

and restore it to portrait on stopping the video:

cordova.require('cordova/plugin/screenorientation').set("portrait");

Upvotes: 2

Marcin Mikołajczyk
Marcin Mikołajczyk

Reputation: 731

you can't change that in phonegap.

you can set it in AndroidManifest.xml, just add

android:screenOrientation="landscape" 

to your <activity>

But then, whole application will be set to landscape.

Upvotes: -1

Related Questions