Re: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-14 Thread Matt Neuburg
On Sun, 13 Mar 2011 15:14:53 -0700, Steve Christensen puns...@mac.com said:
On Mar 13, 2011, at 11:05 AM, Matt Neuburg wrote:

 On Tue, 08 Mar 2011 17:01:33 -0800, Steve Christensen puns...@mac.com said:
 The setup has a MPMoviePlayerController instance that is playing a local 
 audio file. There is also a UIWebView whose HTML contains an audio tag. 
 When the play control is tapped, I see a 
 MPMoviePlayerPlaybackDidFinishNotification notification with a reason of 
 MPMovieFinishReasonPlaybackEnded, then gdb shows the assertion failure and 
 exception and dumps the backtrace (below).
 
 What was the outcome on this? Thx - m.

Well, I'm still not sure of the exact why for the assertion, but I figured 
out what I was doing that it didn't like.

My MPMoviePlayerPlaybackDidFinishNotification handler is designed to queue up 
another audio file to play after the current one finishes. I NSLog'd the 
player initialization and all the notification handlers so I could watch the 
process more in realtime, and found that the next audio file was loaded and 
then very soon after got a MPMoviePlayerPlaybackDidFinishNotification. A bit 
after that is when the assertion failure and exception come along.

After playing with it for a bit, I found that the player's loadState property 
is set to (MPMovieLoadStatePlayable | MPMovieLoadStatePlaythroughOK) when 
playback finishes normally or MPMovieLoadStateUnknown when it's stopped 
because another player instance has grabbed control. I've added a test that 
prevents the queueing if the loadState is MPMovieLoadStateUnknown and that 
seems to work just fine.

I may have missed something in the docs that talks about this situation, but 
it's also probably true that I'm not using the player class in the most 
standard manner.

Thanks, Steve - mostly I just wanted to make sure that this wasn't something I 
was likely to encounter, and you've made clear that it isn't, since the cause 
of the issue was really the automatic queuing behavior. This explains 
perfectly how you could be getting a didBecomeActive notification right after 
playback finishes: *you* were making the MPMoviePlayerController active once 
again.

I guess I'm not surprised that the MPMoviePlayerController would not like your 
loading up an audio file while the UIWebView is already playing an audio file, 
since there is this rule that There Can Be Only One - for example, trying to 
put two MPMoviePlayerController views into your app and playing them both 
simultaneously won't work either. This is part of the price we pay for the 
simplicity of these ways of playing sound.

Glad you got it straightened out - m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-13 Thread Matt Neuburg
On Tue, 08 Mar 2011 17:01:33 -0800, Steve Christensen puns...@mac.com said:
The setup has a MPMoviePlayerController instance that is playing a local audio 
file. There is also a UIWebView whose HTML contains an audio tag. When the 
play control is tapped, I see a MPMoviePlayerPlaybackDidFinishNotification 
notification with a reason of MPMovieFinishReasonPlaybackEnded, then gdb shows 
the assertion failure and exception and dumps the backtrace (below).

What was the outcome on this? Thx - m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-13 Thread Steve Christensen
On Mar 13, 2011, at 11:05 AM, Matt Neuburg wrote:

 On Tue, 08 Mar 2011 17:01:33 -0800, Steve Christensen puns...@mac.com said:
 The setup has a MPMoviePlayerController instance that is playing a local 
 audio file. There is also a UIWebView whose HTML contains an audio tag. 
 When the play control is tapped, I see a 
 MPMoviePlayerPlaybackDidFinishNotification notification with a reason of 
 MPMovieFinishReasonPlaybackEnded, then gdb shows the assertion failure and 
 exception and dumps the backtrace (below).
 
 What was the outcome on this? Thx - m.

Well, I'm still not sure of the exact why for the assertion, but I figured 
out what I was doing that it didn't like.

My MPMoviePlayerPlaybackDidFinishNotification handler is designed to queue up 
another audio file to play after the current one finishes. I NSLog'd the player 
initialization and all the notification handlers so I could watch the process 
more in realtime, and found that the next audio file was loaded and then very 
soon after got a MPMoviePlayerPlaybackDidFinishNotification. A bit after that 
is when the assertion failure and exception come along.

After playing with it for a bit, I found that the player's loadState property 
is set to (MPMovieLoadStatePlayable | MPMovieLoadStatePlaythroughOK) when 
playback finishes normally or MPMovieLoadStateUnknown when it's stopped because 
another player instance has grabbed control. I've added a test that prevents 
the queueing if the loadState is MPMovieLoadStateUnknown and that seems to work 
just fine.

I may have missed something in the docs that talks about this situation, but 
it's also probably true that I'm not using the player class in the most 
standard manner.

steve

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-09 Thread Dave Camp
I saw that assertion yesterday in a bit of code that was accidentally calling a 
MPMoviePlayerController method from a secondary thread.

Dave

On Mar 8, 2011, at 5:01 PM, Steve Christensen wrote:

 I'm seeing the above assertion in an app running on iOS 4.2.1. It then throws 
 an NSInternalInconsistencyException with the reason: movie player 
 MPMoviePlayerControllerNew: 0x446fbe0 has wrong activation state (1).
 
 The setup has a MPMoviePlayerController instance that is playing a local 
 audio file. There is also a UIWebView whose HTML contains an audio tag. 
 When the play control is tapped, I see a 
 MPMoviePlayerPlaybackDidFinishNotification notification with a reason of 
 MPMovieFinishReasonPlaybackEnded, then gdb shows the assertion failure and 
 exception and dumps the backtrace (below).
 
 If I start playing the HTML's audio then start the MPMoviePlayerController's 
 audio, the HTML's audio fades out and the MPMoviePlayerController's plays, so 
 there's probably some subtle difference I'm missing. Any ideas what I might 
 be doing wrong or what to look at? Everything is working great except when it 
 comes time for dueling audio.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-08 Thread Steve Christensen
I'm seeing the above assertion in an app running on iOS 4.2.1. It then throws 
an NSInternalInconsistencyException with the reason: movie player 
MPMoviePlayerControllerNew: 0x446fbe0 has wrong activation state (1).

The setup has a MPMoviePlayerController instance that is playing a local audio 
file. There is also a UIWebView whose HTML contains an audio tag. When the 
play control is tapped, I see a MPMoviePlayerPlaybackDidFinishNotification 
notification with a reason of MPMovieFinishReasonPlaybackEnded, then gdb shows 
the assertion failure and exception and dumps the backtrace (below).

If I start playing the HTML's audio then start the MPMoviePlayerController's 
audio, the HTML's audio fades out and the MPMoviePlayerController's plays, so 
there's probably some subtle difference I'm missing. Any ideas what I might be 
doing wrong or what to look at? Everything is working great except when it 
comes time for dueling audio.

steve

-
0   CoreFoundation  0x314d0987 __exceptionPreprocess + 114
1   libobjc.A.dylib 0x319a149d objc_exception_throw + 24
2   CoreFoundation  0x314d07c9 +[NSException raise:format:arguments:] + 68
3   Foundation  0x31d1629f -[NSAssertionHandler 
handleFailureInMethod:object:file:lineNumber:description:] + 62
4   MediaPlayer 0x360b1571 -[MPMoviePlayerControllerNew 
_moviePlayerDidBecomeActiveNotification:] + 124
5   Foundation  0x31cd8623 _nsnote_callback + 142
6   CoreFoundation  0x31457123 __CFXNotificationPost_old + 402
7   CoreFoundation  0x31456dc3 _CFXNotificationPostNotification + 118
8   Foundation  0x31cc7d23 -[NSNotificationCenter 
postNotificationName:object:userInfo:] + 70
9   MediaPlayer 0x360b0e09 -[MPMoviePlayerControllerNew 
_postNotificationName:object:userInfo:] + 72
10  MediaPlayer 0x360b0e41 -[MPMoviePlayerControllerNew 
_postNotificationName:object:] + 24
11  MediaPlayer 0x360b0fc1 -[MPMoviePlayerControllerNew _resignActive] + 52
12  MediaPlayer 0x360b2fb7 -[MPMoviePlayerController _resignActive] + 66
13  CoreFoundation  0x31473fc7 -[NSObject(NSObject) performSelector:] + 18
14  CoreFoundation  0x3147cd51 -[NSArray makeObjectsPerformSelector:] + 388
15  MediaPlayer 0x360b44a1 +[MPMoviePlayerController 
allInstancesResignActive] + 32
16  MediaPlayer 0x360bc143 -[UIMoviePlayerController _ensureActive] + 62
17  MediaPlayer 0x360b8d17 -[UIMoviePlayerController 
videoController:tappedButtonPart:] + 18
18  MediaPlayer 0x36115cfb -[MPInlineVideoViewController 
transportControls:tappedButtonPart:] + 78
19  MediaPlayer 0x360e4f75 -[MPTransportControls _handleTapForPart:] + 112
20  MediaPlayer 0x360e54ad -[MPTransportControls buttonUp:] + 60
21  CoreFoundation  0x31477fed -[NSObject(NSObject) 
performSelector:withObject:withObject:] + 24
22  UIKit   0x338c14ad -[UIApplication sendAction:to:from:forEvent:] + 
84
23  UIKit   0x338c144d -[UIApplication 
sendAction:toTarget:fromSender:forEvent:] + 32
24  UIKit   0x338c141f -[UIControl sendAction:to:forEvent:] + 38
25  UIKit   0x338c1171 -[UIControl(Internal) 
_sendActionsForEvents:withEvent:] + 356
26  UIKit   0x338c19cf -[UIControl touchesEnded:withEvent:] + 342
27  UIKit   0x338b7355 -[UIWindow _sendTouchesForEvent:] + 368
28  UIKit   0x338b6ccf -[UIWindow sendEvent:] + 262

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com