views:

1511

answers:

3

I'd like to add custom controls to the mediaPlayer control view much as this asker:

http://stackoverflow.com/questions/190493/add-custom-controls-to-movieplayer

However, the solution posted in the above question is depreciated in 3.0. Does anyone know of a way to do this with the new SDK?

So far I have added an overlayView to the moviePlayer view and can display my own controls on touch, but I can't seem to pass the touch on to the moviePlayer view to get it to display the native controls.

I've been using touchesBegan and touchesEnded to no avail. Any help is appreciated.

+1  A: 

look at this sample project http://developer.apple.com/iphone/library/samplecode/MoviePlayer_iPhone/ it does it in there

Daniel
Thank you Daniel, but I have looked extensively at that project, and it does not display custom controls like I want. As the asker asked in the link that I posted, I want to add controls to the media player much like in the Youtube app, which appear with the native controls when the user touches the screen (ie. alongside Prev/Play/Next). The MoviePlayer project you've linked to definitely does not do this.
The movie player shows that you can add the controls on the screen there, its up to you to implement the specifics, you can Hide the default controls in the movie player and put your own there just like the put the 2 buttons on there you can use the same approach to add the controls you want...
Daniel
So, you're suggesting that the simplest way is to re-implement the scrolling position indicator, volume slider, play/next/prev etc... along with my own custom controls?
but you dont have to, you can put your custom controls along the top of the video, unfortunatly you dont have access to the bar that currently shows on the movie player, apple made the you tube app, so they have access to whatever they want, but you dont...
Daniel
I see your point Daniel, and thank you. However, I'm hoping that someone may have a suggestion of how to display the native controls programatically. Anyone?
*clarification* I mean I'd like the native controls to simply be shown programatically - ie. called by code. At that point I can overlay my controls...
you can overlay your controls over the native controls but you Cannot customize the native controls, you can make it look like its customized by adding your controls ontop of the native controls
Daniel
or do you mean you want to be able to display the controls when you want them to display and not just when the user double clicks?
Daniel
No, I want my controls to appear along with the native controls. The trouble I'm having is that I can add an overlay view with custom controls that appears and disappears on touch, but the native controls don't appear at the same time. I thought it would be as simple as sending touchesBegan and touchesEnded somewhere where movieplayer could catch them and show its controls, but that doesn't seem to be working for me.
+1  A: 

Found an answer to my own question from: http://blogs.oreilly.com/iphone/2008/11/the-joys-of-vertical-audio.html

Namely, I'm using:

id internal;
object_getInstanceVariable( mVideoPlayer, "_internal", (void*)&internal);
id videoViewController;
object_getInstanceVariable(internal, "_videoViewController", (void*)&videoViewController);
id vvController = videoViewController;

Then I can do:

[[vvController _overlayView] addSubview:controlImage];

It's still quite hack-y but hopefully this will help someone else...

+1  A: 

Hi Ian I'm having the same problem but I didn't understand how this helps you in display your own controls on touch, and still be able to pass the touch on to the moviePlayer view to get it to display the native controls.

The solution I found (above) allows you to get a hold of the videoViewController and add your own subview to it. So you're adding your own images to the controller's view, not creating a new view. This is a hack and not supported by apple AFAIK.