4

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

Ronnie
  • 11,138
  • 21
  • 78
  • 140

1 Answers1

1

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

Dawson Toth
  • 5,580
  • 2
  • 22
  • 37
  • Man, I was hopeful it was going to be an answer like this. Unfortunately, changing it from `Ti.Media.VIDEO_CONTROL_DEFAULT` to `EMBEDDED` had no affect. – Ronnie Aug 27 '12 at 16:22
  • You can also look in the source yourself where I've posted and change it to set the anchor view as per your desires. Or if you're only concerned with this one device, height: deviceHeight / 2 - 50ish. – Dawson Toth Aug 27 '12 at 16:54
  • It isn't just for this one device, besides changing the height to -50ish will just make the whole video smaller. I posted this question a while ago when I was working with java http://stackoverflow.com/questions/7881272/extending-mediacontroller-for-android and ran into this same issue. I think it is going to have to do with something in addition to `setAnchorView`. If you think using the `EMBEDDED` control style is the correct way to do this, a little example would be awesome – Ronnie Aug 27 '12 at 17:09