(iPad; SDK 2.1.1)
When I close the video window the app will switch to vertical orientation (the window only, the simulator is still in horizontal mode so there are bars on the left/right side and all elements (here v) disapear):
var w = Ti.UI.createWindow({backgroundColor:'#fff',fullscreen:true,orientationModes:[Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]}); var v = Ti.UI.createView({backgroundColor:'#faf',left:10,top:10,width:100,height:100}); var b = Ti.UI.createButton({title:"click"}); // check if video is available b.addEventListener("click",function(e){ // load video var winVideo = Titanium.UI.createWindow({ title:'Video Player', backButtonTitle: 'Videos', barColor: '#000', backgroundColor:'#000', orientationModes:[Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT] }); var videoPlayer = Titanium.Media.createVideoPlayer({ url: "v.mp4", backgroundColor: '#000', fullscreen:true, scalingMode: Titanium.Media.VIDEO_SCALING_ASPECT_FIT, mediaControlMode: Titanium.Media.VIDEO_CONTROL_EMBEDDED, }); winVideo.add(videoPlayer); videoPlayer.addEventListener('complete', function(e){ if (e.reason == 0) { winVideo.close(); }; }); videoPlayer.addEventListener('fullscreen', function(e){ if (e.entering == 0) { winVideo.close(); }; }); winVideo.open({animated:false}) }); w.add(b); w.add(v); w.open();
tiapp.xml:
<statusbar-style>default</statusbar-style> <statusbar-hidden>true</statusbar-hidden> <fullscreen>true</fullscreen> <navbar-hidden>true</navbar-hidden>If I'm not in fullscreen mode it will work!
4 Answers
Hi michael, if you want that whole your application run in a single mode then you can do this by doing some changes in Info.plist and tiapp.xml.This will solve your issue. for tiapp.xml do this
<iphone> <orientations device="iphone"> <orientation>Ti.UI.LANDSCAPE_LEFT</orientation> <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation> </orientations> <orientations device="ipad"> <orientation>Ti.UI.LANDSCAPE_LEFT</orientation> <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation> </orientations> </iphone>and in info.plist
<key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array>i hope this will help you.
just check some other SDKs
2.0.3 v20120806151610: good
2.1.1: wrong
2.2.0.v20120807144112: wrong
can't use 2.0.3 cause its crashing when changing a scrollableview when there is an animation playing
I have the same with video player and modal fullscreen window. See example here: http://developer.appcelerator.com/question/141321/videoplayer-zoom-out-and-window-orientation-mode#answer-246121
2.1.3 RC fixed the problem!
Your Answer
This question has been locked and cannot accept new answers.