Ronnie
Ronnie

Reputation: 11198

Android Video Control Position in Titanium

I have an issue with the android video controls. I have a video player that is half the height of the device and positioned at top:0

When the video controls pop up, they are positioned below the video player, thus covering the content below the video player. What I'd like to do is position the controls over top the video, but still at the bottom. The same way the iOS video player works.

Right now the controls are basically outside the height of the video player. When I was developing for Android natively, I ran into this same issue and it was fixed by using the setAnchorView method in Java. I haven't seen anything like this in titanium. Is this even possible?

I tried wrapping the player inside a view and it produced the same result.

var deviceWidth = Ti.Platform.displayCaps.platformWidth;
var deviceHeight = Ti.Platform.displayCaps.platformHeight;

var vidPlayer = Ti.Media.createVideoPlayer({
    width:deviceWidth,
    height:deviceHeight / 2,
    top:0,
    backgroundColor:'#ffffff',
    autoplay:false
});
win.add(vidPlayer);

Here is an image of what I am talking about

video controls outside bounding box

Upvotes: 4

Views: 975

Answers (1)

Dawson Toth
Dawson Toth

Reputation: 5680

Set the media control style to embedded on the video player:

mediaControlStyle: Ti.Media.VIDEO_CONTROL_EMBEDDED

Under the covers, this sets the anchor view. https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/media/src/java/ti/modules/titanium/media/TiUIVideoView.java#L211

Docs for Ti.Media.VideoPlayer.mediaControlStyle: http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.Media.VideoPlayer-property-mediaControlStyle

Docs for Ti.Media.VIDEO_CONTROL_EMBEDDED: http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.Media-property-VIDEO_CONTROL_EMBEDDED

Upvotes: 1

Related Questions