Advertise Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Your First iPhone App
($1.99)

iPhone Code Generator
($9.99)

Calcuccino Programmers' Calculator
($2.99)

DataFon(Build Apps on Windows)
(free)

Infinote Pinboard for Todos and Notes
(free)

picplz
(free)

poG
($2.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-31-2009, 10:41 PM   #1 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 2,123
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default Using MPMoviePlayerController undocumented methods...

First off, I know this is wrong, but since this app is for personal use, I don't think it's gonna hurt anyone if I use a few undocumented calls.

Here's what I'm trying to do:

I have an overlay view on top of a MPMoviePlayerController .. nothing hard about that.

Now, when I click one of the buttons, I want to get the current time of the video that's being played. For this, there's a "currentTime" method in the mpmovieplayercontroller class.

However, when compiling, I get the ole warning "MPMoviePlayerController" may not respond to '-currentTime'. This method is assumed to return 'id' and accept '...' as arguments.


So my problem is that I need to get a 'double' value from the currentTime rather than an object. I've tried casting, but this doesnt work either.

Any suggestions?

Just to clarify, the mpmovieplayercontroller has a method with signature:
Code:
-(double)currentTime;
But the compiler assumes it looks like this:
Code:
-(id)currentTime;
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-01-2009, 09:21 AM   #2 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 2,123
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

bump
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-01-2009, 10:16 AM   #3 (permalink)
Registered Member
 
mnemonic_fx's Avatar
 
Join Date: Jun 2008
Posts: 419
Default

What is the exact class name of the object ?

Code:
NSLog(@"%@", [[self currentTime] description]);
__________________
Visit Me

Writing code is not only about writing instructions to a machine / computer, but also about writing something that could be read, understood, and maintained by others. That's why, I like Cocoa.
mnemonic_fx is offline   Reply With Quote
Old 06-01-2009, 11:16 AM   #4 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 2,123
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

Not near my mac right now, but thanks for the idea. I'll let you know as soon as I get home from my day job lol.
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-01-2009, 07:22 PM   #5 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 2,123
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

Here's my stuff:

Code:
MPMoviePlayerController* video = ...
Now, as you suggested:
Code:
NSLog(@"%@", [[video currentTime] description]);
This throws an EXC_BAD_ACCESS, my guess is because the method actually returns a primitive type, rather than an NSObject.

If I just do
Code:
NSLog(@"%@", [video currentTime]);
I also get an EXC_BAD_ACCESS

Now, if I do
Code:
NSLog(@"%.2f", [video currentTime]);
I get "0.00" printed out.

Now the question is, why does it print 0.00 rather than the actual currentTime?
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-02-2009, 05:43 AM   #6 (permalink)
Registered Member
 
mnemonic_fx's Avatar
 
Join Date: Jun 2008
Posts: 419
Default

It might mean that, the currentTime doesn't return anything useful.

What if you passed it as integer using %d ?
__________________
Visit Me

Writing code is not only about writing instructions to a machine / computer, but also about writing something that could be read, understood, and maintained by others. That's why, I like Cocoa.
mnemonic_fx is offline   Reply With Quote
Old 06-02-2009, 09:33 AM   #7 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 2,123
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

That's what I feared. I havent tried using %d yet. I'll do so when I get near my mac again.

On the other hand, I only need the currentTime value to figure out how long the video has been playing. I've tried a workaround by just initializing an NSDate object when I call [video play]. Then, when the video stops, I can call the timeIntervalSinceNow method from NSDate to figure out the elapsed time since the movie started.

The only issue now is that if the user pressed the "pause" button, I have no way of getting notified to adjust the elapsed time. My solution would be to overlay an invisible button on top of the 'pause' button on the movie player so that when the user thinks he/she is hittin pause, they are actually hitting the invis button I've overlayed. This will allow me to capture that event, adjust the elapsed time, and then pass the touch on to the movie player so it can actually pause the movie.

The problem I'm facing here is that I can't figure out how to pass the touch on to be handled by the movie player controller.

Any ideas?
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-02-2009, 10:15 AM   #8 (permalink)
Registered Member
 
mnemonic_fx's Avatar
 
Join Date: Jun 2008
Posts: 419
Default

Have you take a look at HeadsUpUI ?

You can hide the controls by using MPMovieControlModeHidden, and then handle all of the play and stop of MPMoviePlayerController by using that custom button.
__________________
Visit Me

Writing code is not only about writing instructions to a machine / computer, but also about writing something that could be read, understood, and maintained by others. That's why, I like Cocoa.
mnemonic_fx is offline   Reply With Quote
Old 07-27-2009, 11:49 AM   #9 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 11
Default

Quote:
Originally Posted by smithdale87 View Post
That's what I feared. I havent tried using %d yet. I'll do so when I get near my mac again.

On the other hand, I only need the currentTime value to figure out how long the video has been playing. I've tried a workaround by just initializing an NSDate object when I call [video play]. Then, when the video stops, I can call the timeIntervalSinceNow method from NSDate to figure out the elapsed time since the movie started.

The only issue now is that if the user pressed the "pause" button, I have no way of getting notified to adjust the elapsed time. My solution would be to overlay an invisible button on top of the 'pause' button on the movie player so that when the user thinks he/she is hittin pause, they are actually hitting the invis button I've overlayed. This will allow me to capture that event, adjust the elapsed time, and then pass the touch on to the movie player so it can actually pause the movie.

The problem I'm facing here is that I can't figure out how to pass the touch on to be handled by the movie player controller.

Any ideas?
Hi Smithdale,

It's good idea, but if you have slow internet connection, your movie will stops sometimes. In this case you need to catch this event and do the same thing that you want to do with pause buttons. I don't thing that this event exists at all.

Actually, I have the same problem with currentTime functions. I don't know solution yet, but if it helps I tell you that I try to convert the value returned from currentTime functions to each value from this list String Programming Guide for Cocoa: String Format Specifiers , (with stringWithFormat) and each time it returns a garbage
Dmitry is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


» Advertisements
» Stats
Members: 51,374
Threads: 52,830
Posts: 225,477
Top Poster: BrianSlick (3,576)
Welcome to our newest member, bob8caldwell
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:27 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0