Video in haXe on iOS using native extension?

Hi, We are very interested in putting video into our games, either fullscreen video or preferably video which is displayed within the game, around other elements. I know that in Adobe AIR you can use stageWebView for video (though it seems to have som…

Viewing 1 to 11 (11 Total)
Video in haXe on iOS using native extension?

gregdenness

gregdenness
Total Posts: 27
Joined: February 28, 2012

Hi,
We are very interested in putting video into our games, either fullscreen video or preferably video which is displayed within the game, around other elements.

I know that in Adobe AIR you can use stageWebView for video (though it seems to have some problems) or you can navigateToURL for fullscreen video. Is there any way a native extension could be written for haXe which allowed hardware video playback? I have seen the MPMoviePlayerController class in the iOS SDK – could that be used to play video do you think?

Any thoughts on this would be appreciated!

Thanks,
Greg

Tags:
Posted on February 29, 2012 at 5:26 AM

gregdenness

gregdenness
Total Posts: 27
Joined: February 28, 2012

Re: Video in haXe on iOS using native extension?

I forgot to add, since this is for displaying video in a game (like custscenes etc), we would want to to look really seamless, like no switching to other applications, no movie playback controls etc.. Just play a movie and have control over that movie, like being able to know when it has stopped or being able to stop it etc..

Thanks

Posted on February 29, 2012 at 5:33 AM

gregdenness

gregdenness
Total Posts: 27
Joined: February 28, 2012

Re: Video in haXe on iOS using native extension?

I'm answering my own questiosns here lol, yes you can put video into haXe as a native extension, it seems to work pretty well using MPMoviePlayerController. You can have it fullscreen or in an area and you can remove all the playback controls so it blends seamlessly. It also appears to run very smoothly.

I guess ideally I would want to be able to embed the movie like it's done in Flash, so be able to have it attached to movieclip and have alpha, but that seems a bit far fetched since the MPMoviePlayerController has to be attached to a view.

Having video playback at native speeds is a massive boost for us, we rely on video so much in our games.

Posted on March 01, 2012 at 4:26 AM

singmajesty

singmajesty
Total Posts: 2140
Joined: August 25, 2011

Re: Video in haXe on iOS using native extension?

I would love to see a video extension, even if it is only for fullscreen playback, no player controls.

Its a complex subject but the NME extension system should be flexible enough to allow the use of native APIs for each mobile platform. Desktop is another beast altogether smiling

Posted on March 01, 2012 at 11:06 PM

tonypee

tonypee
Total Posts: 33
Joined: March 11, 2012

Re: Video in haXe on iOS using native extension?

So Greg,

Do you have an extension for playing fullscreen video - is that what your saying? Im looking at how to play video, in any fasion. Jumping to fullscreen would be fine - aslong as you can get back to the app. Would you have the native controls and a 'back' button?

any updates on what's available would be great.

cheers

Posted on April 01, 2012 at 11:22 PM

gregdenness

gregdenness
Total Posts: 27
Joined: February 28, 2012

Re: Video in haXe on iOS using native extension?

Hi Tonypee,

I managed to make an extension which will play video, however it still needs a lot of work before it is finished. I did it as a proof of concept to see if it would work so that I can come back to it later and finish it when required.

We are currently at the initial stages of porting a large game from PC/Flash to iOS/Android and I needed to know that video was going to work. I will finish the extension at some point (unless someone does it before me), but it wont be for a while unfortunately.

Thanks,
Greg

Posted on April 02, 2012 at 4:03 AM

tonypee

tonypee
Total Posts: 33
Joined: March 11, 2012

Re: Video in haXe on iOS using native extension?

Okay, good, kinda.

Well i'll need something in the next few weeks. Would there be a change that you can you post up what you have done somewhere? maybe it will suffice. Any working sample would be GREAT!

cheers
Tony

Posted on April 02, 2012 at 4:11 AM

exdev

exdev
Total Posts: 93
Joined: March 09, 2012

Re: Video in haXe on iOS using native extension?

+1 for sharing (if possible) grin

Posted on April 04, 2012 at 10:39 AM

gregdenness

gregdenness
Total Posts: 27
Joined: February 28, 2012

Re: Video in haXe on iOS using native extension?

Hi,

I can share what I have so far, but it's not exactly a working extension. I had actually just taken the hxgk project (as it's the only iphone extension I could find) and stuck some code in there just so I could see if movies would work (and they do). You could take the hxgk project and strip it out to form the basis of a new extension for iPhone.

The code is:

MPMoviePlayerController *moviePlayer;

NSURL *url = [NSURL URLWithString:@"http://www.inertiasoftware.com/test.mp4"];

moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url];

moviePlayer.controlStyle = MPMovieControlStyleNone;
moviePlayer.shouldAutoplay = YES;

UIWindow* window = [UIApplication sharedApplication].keyWindow;
[window addSubview:moviePlayer.view];

// [moviePlayer setFullscreen:YES animated:YES];
moviePlayer.view.frame = CGRectMake(0, 0, 640, 480);


That will load and display a video in a (0,0,640,480) rectangle at full speed on the iPad. As you can see it needs a lot of work to make it into a fully working extension, but if anyone wants to do so I would be very interested. I think it should be able to do everything you need, you can display controls (or not) and probably get callbacks for all the essential things like stopping etc...

If no one else works on this then I will eventually do it, but it will be later on, near the end of our porting project. I kinda hope someone else does it as I hate objective C... =)

Anyway, I hope this helps! If anyone wants to do an Android version or knows if this is possible on Android then I'd love to hear, maybe we can work together on it.

Greg Denness

Posted on April 04, 2012 at 11:17 AM

tonypee

tonypee
Total Posts: 33
Joined: March 11, 2012

Re: Video in haXe on iOS using native extension?

I have a project where i will need video - so i am willing to pay for a simple extension to be made. If anyone is interested please get in contact with me:

tonyp[-AT-]touchmypixel.com

Posted on April 12, 2012 at 10:09 PM

emibap

emibap
Total Posts: 28
Joined: February 29, 2012

Re: Video in haXe on iOS using native extension?

Hi guys,

I've made a very limited version of a VideoPlayer NME extension. You can check it out here:
http://github.com/emibap/nmeXtensions/tree/master/VideoPlayer...

Currently supports a fullscreen viewController for local or http video playback, with the default controls (iOS only). I'll be adding event handling or callbacks and more functionality in the near future.

It has one issue related to device orientation, but works fine.

Anyway, it's functional ;)

Posted on May 21, 2012 at 9:01 AM