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

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.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 01-26-2010, 04:07 AM   #1 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Default MediaPlayer playing sound in silence mode? WTF?

Hi there!

I'm using a video as an introduction of my game and I've recently added audio to that video (in .mp4 format). And what's my surprise when I've seen that movie''s audio is played even if the device is in silence mode! What can be happening? I've thought that no sound is being played if the device is in vibration mode...
I post the code because I don't know if it's something I did wrong...

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {

	NSBundle *bundle = [NSBundle mainBundle];
	
	NSString *moviePath = [bundle pathForResource:@"intro" ofType:@"m4v"];
	NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
	theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

	theMovie.movieControlMode = MPMovieControlModeHidden;
	
	[theMovie play];
}
Thanks in advance! ^_^
Johanovski is offline   Reply With Quote
Old 03-04-2010, 02:14 PM   #2 (permalink)
Registered Member
 
Gomfucius's Avatar
 
Join Date: May 2009
Location: San Francisco
Posts: 47
Default

I'm having the same issue now.
Also, I want to be able to control the sound when I play my movie.


Quote:
Originally Posted by Johanovski View Post
Hi there!

I'm using a video as an introduction of my game and I've recently added audio to that video (in .mp4 format). And what's my surprise when I've seen that movie''s audio is played even if the device is in silence mode! What can be happening? I've thought that no sound is being played if the device is in vibration mode...
I post the code because I don't know if it's something I did wrong...

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {

	NSBundle *bundle = [NSBundle mainBundle];
	
	NSString *moviePath = [bundle pathForResource:@"intro" ofType:@"m4v"];
	NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
	theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

	theMovie.movieControlMode = MPMovieControlModeHidden;
	
	[theMovie play];
}
Thanks in advance! ^_^
Gomfucius is offline   Reply With Quote
Old 03-19-2010, 03:23 AM   #3 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Default

Hi Gomfucius!

It seems that's not possible to control a movie's volume programmatically and, what I think is worst, the mediaplayer completely ignores if the device is in silence or not, so sound will be played anyway. What I've done is to have the same video with sound and without sound and, just after loading the video, I check if the device is in silence mode or not and, if yes, I load the silenced video or, if not, I load the video with sound. It's a bit annoying having to do this way, but it's the only way I've found...

Hope it helped!
Johanovski is offline   Reply With Quote
Old 03-19-2010, 12:48 PM   #4 (permalink)
Registered Member
 
Gomfucius's Avatar
 
Join Date: May 2009
Location: San Francisco
Posts: 47
Default

That's a pain! My movie is about 10MB, so I really shouldn't make users install another 10MB..
Thanks for the reply!
Gomfucius is offline   Reply With Quote
Old 03-22-2010, 05:22 AM   #5 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Default

Hi Gomfucius!

Lucky that my movie is only about 0.5 MB so it isn't a big pain to have a silenced copy... Maybe there's another way to make sure a movie is silenced after playing it, but I didn't find it yet, maybe if you ask in forums or google for it you'll be luckier than me (and if so please let me know why this can be done! )!

Good luck!
Johanovski is offline   Reply With Quote
Reply

Bookmarks

Tags
movieplayer, silence, sound

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
» Online Users: 256
21 members and 235 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, dacapo, Dani77, DarkAn, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, ryantcb, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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