Trouble Overlay a button (or any Display Object) over a native.newVideo()

I am trying to use the new native.newVideo() API to do a game intro trailer. I want to have a button that shows which the user can tap to skip the video. Below is a code sample.

The problem I have when running the code is that the button shows up, then is quickly covered by the video. So, the user simply can’t push the button.

Is this a bug, or is it something I am doing wrong?

[code]
– local video = native.newVideo( 0, 0, 320, 480 )
local scale = mMin(display.contentScaleX, display.contentScaleY);

video = native.newVideo (0,0,320,480); – assume 320x480 dimension video
video.xScale = 1 / scale;
video.yScale = 1 / scale;
video:setReferencePoint(display.CenterReferencePoint);
video.x = _W * 0.5;
video.y = _H * 0.5;
video:load( “SampleVideo.m4v”, system.ResourceDirectory )
localGroup:insert (video);

– play the video, and remove it when it finishes (with a bit of buffer on time delay);
video:play();
videoPlayTimer = timer.performWithDelay(video.totalTime*1000 + 500, finishedVideo);

– skip button
local playBtn = ui.newButtonRect{
default = “images/Btn_Play.png”,
over = “images/Btn_Play_Over.png”,
width = 48,
height = 48,
onEvent = onPlayBtnTouch,
id = “playBtn”
}

[/code] [import]uid: 41124 topic_id: 21598 reply_id: 321598[/import]

Just figured it out. Apparently native objects can’t be placed into display Object. For those interested, here is the link.

Duh…

http://blog.anscamobile.com/2012/01/using-the-new-native-web-video-apis/ [import]uid: 41124 topic_id: 21598 reply_id: 85652[/import]

Unfortunately, this is by design. All “native” object such as the video view, web view, TextBox, ad banners, etc. are always overlaid on top of all display objects. Just think how web popups work in Corona… video views work in the same manner. This is because display objects such as your button are rendered to an OpenGL view which covers the entire window and naturally needs to be at the back of the z-order.

So, the only thing you is to display your button around the video view that you have created.

Now, if we’ve implemented an augmented reality feature which involves rendering a video feed straight to an OpenGL polygon, well then this would be possible. However, only the latest greatest mobile devices support such a featureParticularly on Android where only 4.0 devices support it.

Anyways, I hope this helps. [import]uid: 32256 topic_id: 21598 reply_id: 85654[/import]

Thanks Josh for the quick response!

Incidentally, I may have run into a documentation bug (or it could be my fault). According to the doc, native.newVideo() is supported on Android, but when I tested, the same code that works on iOS won’t work on my Android device. It’s possible the issue is with the codec of the video that I am testing, but I have been trying out all sorts of video formats with no luck - leading me to think it may be .newVideo() isn’t supported on Android, yet?

Thx!

I am using the latest 2012.741 build.
Ps. I have just posted the same question onto this blog thread (My comment is still waiting moderation).

http://blog.anscamobile.com/2012/01/using-the-new-native-web-video-apis/comment-page-1/#comment-6741 [import]uid: 41124 topic_id: 21598 reply_id: 85659[/import]

It’s not yet available on Android or Mac. But it is high on our todo list. [import]uid: 7563 topic_id: 21598 reply_id: 85748[/import]

Thanks! Looking forward to Android support. This is awesome! [import]uid: 41124 topic_id: 21598 reply_id: 88487[/import]