"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Play remote video on image use calayer (sample code)

I would like to share my recent work about playing video on trackable image, and ask some help.

Thank for vuforia team to release the sample code about how to play video using the vuforia sdk, they use avassetreaderoutput to render video pixel on the opengl texture.

However avassetreader can only work on local video file, if you want to play remote video, you need use native mpmovieplayer and into the fullscreen mode.

I try to solve this problem.

The idea is simple.

1.I don't use avassetreader to read the video pixel, instead I use AVPlayer and AVPlayerLayer which can play remote video file.

2.I need to convert opengl modelview matrix to CATransform3D so the AVPlayerLayer will attach on the trackable image.Thanks for Hammer on stackoverflow, he shared an example about how to make this.

3.I tried to render camera background use opengl and AVPlayerLayer at same time, but the performace is not good enough, so I use another calayer to render the camera background. There is a bug in 1.5.8 when getting camera frame, thank for andersfrank the problem was solved here.

I put my code on pastebin:

http://pastebin.com/kmeVZ7jy

 

I can play remote video now, but still have some problem need to solve:

1. I can't make the video flip up-side down.

2. it's also strange that I need to set m22 and m33 negative in scalingMatrix or the convertion between the modelview matrix and catransform3d is not correct. 

3. When I rotate my iphone, the attitude of AVPlayerLayer is not quiet well, may be the convertion is not good enough.

 

Image removed. 

this one looks good.

Image removed.

this one is not.

 

I was stuck on this problem about 3 weeks. Please check the code and give me some feedback.

Thank you very much.

junkieHead

Thu, 09/13/2012 - 08:25

Note that ARCALView is a subclass of UIView and not UIViewCOntroller . So, if you try to present another viewcontroller modally then it will throw exception. You should add your new view as a subview of ARCALView. That should sove your issue.

Hi Tim,

Would you please send the source code to the below address for this query,so I can search how to resolve it.

gunsel5537@yahoo.com.cn

Daniel Cho

Firstly TimLai, Great Code!! It has really helped me out!

I am having a bit of trouble with the position of the video on the trackable.

Does anyone know how I can bind the position, scale, skew  of the video to the position, scale and skew of the trackable?

I tried to fix getPose with code snippet from EAGLView so it could build and QCAR hints with some hints from EAGLview as well, but ended up with:

2013-07-04 15:47:32.422 ImageTarget[1705:907] APPSTATUS_INITED

fabricvuforia

Fri, 08/09/2013 - 10:07

I have just come across this and hopefully will be implimenting it in combination with the Cloud recognition to play the videos on the fly, somehting which many people seem to be asking questions about.