Hi, I am running iOS 7.0.3 and Titanium 3.2.1. I have what I thought would be a pretty simple task. All I want is a full-screen view that will contain a video in the middle of the screen and other UI elements at the top and bottom. But the video will be loaded in dynamically so I don't know the width and height beforehand. My plan was to just set the width to 80% of the screen, and let the height be determined automatically:
var self = Ti.UI.createWindow({ backgroundColor:'#red', }); var tmpView = Titanium.Media.createVideoPlayer({ url:path, backgroundColor:'white', width: Ti.Platform.displayCaps.platformWidth * 0.8, // height: Ti.UI.SIZE, autoplay: false, mediaControlStyle: Titanium.Media.VIDEO_CONTROL_EMBEDDED, }); var view = Ti.UI.createView({ backgroundColor : 'black', width: Ti.Platform.displayCaps.platformWidth, height: Ti.Platform.displayCaps.platformHeight }); view.add(tmpView); self.add(view);But this is the result when I run it
I chose the background colors for clarity so you can see what's happening: although the video is displaying correctly, the video player view is taking up the full height of the screen, so the controls appear way down at the bottom. I need the controls to be directly below the video content.
I tried setting the height to Ti.UI.FILL and 'auto' and saw the same results. (Ti.UI.SIZE caused the video to not show up at all.) I also tried other mediaControlStyle settings. The only thing that worked while testing was setting the height explicitly to a number, which I won't have for the real app. I also tried using a 'postlayout' event to read in what the height of the loaded in video actually is, but when I output e.source.size.height it just returns 568, the height of the screen.
Does anybody have any ideas how I could either set the height of the video player correctly, or, if not, at least override the controls to appear below the video? Thanks!