avaudioplayer

iOS: Displaying currently played track info in LockScreen?

若如初见. 提交于 2019-12-18 04:19:10
问题 As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and the artwork on the lockscreen with MPNowPlayingInfoCenter , but the only way to do this (As far as I know) is to use MPMusicPlayerController and get nowPlayingItem ... The problem is that MPMusicPlayerController is used to play iPod Music only, and

iOS: Displaying currently played track info in LockScreen?

你说的曾经没有我的故事 提交于 2019-12-18 04:19:09
问题 As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and the artwork on the lockscreen with MPNowPlayingInfoCenter , but the only way to do this (As far as I know) is to use MPMusicPlayerController and get nowPlayingItem ... The problem is that MPMusicPlayerController is used to play iPod Music only, and

Resume Background Audio After Playing Sound With AVAudioPlayer

烈酒焚心 提交于 2019-12-18 04:17:06
问题 I am looking for a way to resume audio played by another application after my application plays its own sound with AVAudioPlayer. Right now, if I am listening to music and launch my application, it pauses the music, plays my sound, but doesn't resume the background music. Here is what i'm doing to generate the sound playback: myChime = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"chime" ofType:@"mp3"]] error:nil]; myChime

Streaming with an AVAudioplayer

蹲街弑〆低调 提交于 2019-12-18 04:13:34
问题 In order to load a sound file, I have the following code in my application : - (id) init:(NSString*)a_filename ext:(NSString*)a_ext { ... NSString *t_soundFilePath = [CFileLoader getPathForResource:filename WithExtension:ext]; NSURL *t_fileURL = [[[NSURL alloc] initFileURLWithPath: t_soundFilePath] autorelease]; player = [[AVAudioPlayer alloc] initWithContentsOfURL: t_fileURL error: nil]; [player prepareToPlay]; ... } All the sounds that I load are in my bundle, so I would like to know if the

Swift: how to set the iphone volume programmatically [duplicate]

我只是一个虾纸丫 提交于 2019-12-18 04:12:44
问题 This question already has answers here : How to change device Volume on iOS - not music volume (8 answers) How to change an iOS device volume programmatically? (4 answers) Closed 3 years ago . I am trying to create an alarm app and I have noticed that apps like Sleep Cycle will set your volume to max right before the alarm goes off, even if you had the volume at very low. I have tried using AVAudioPlayer and all I have seen with MPVolumeView is that the user must do it. Is there any way I can

Sound not playing with AVAudioPlayer

廉价感情. 提交于 2019-12-18 03:37:12
问题 I've searched and I believe my problem is quite unique. I'm aware of the Simulator 5.1 bug when using AVAudioPlayer which isn't my problem. I'm running on a iOS 5.1 device. Here's my header file: #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import <AVFoundation/AVAudioPlayer.h> -(IBAction)pushBell; @end and my implementation file: #import "BellViewController.h" @interface BellViewController () @end @implementation BellViewController -(IBAction)pushBell { NSString *soundPath =[

iOS - AVAudioPlayer doesn't continue to next song while in background

别说谁变了你拦得住时间么 提交于 2019-12-18 01:14:30
问题 So I have an app that plays a bunch of songs while the user can flip through a comic book. I use AVAudioPlayer and I have it set up to play the songs in a set order. So when one song finishes, the next one will play. This works flawlessly when the app is open. The problem occurs when the app is in the background. I set up the app to play in the background, and that works fine. So when the user presses the home screen the music continues to play. The problem occurs when the song ends, it is

sound and Nstimer stopped when iphone is in deepsleepmode?

徘徊边缘 提交于 2019-12-17 19:31:31
问题 I am creating an application in which I'm using nstimer and avaudioplayer to play sound,but both sound and timer stops when phone is in deep sleep mode.how to solve this issue? here is the code to play audio -(void)PlayTickTickSound:(NSString*)SoundFileName { //Get the filename of the sound file: NSString *path = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] resourcePath],[NSString stringWithFormat:@"/%@",SoundFileName]];// @"/Tick.mp3"]; //Get a URL for the sound file NSURL

Concatenate two audio files in Swift and play them

天大地大妈咪最大 提交于 2019-12-17 19:25:13
问题 I try to concatenate .wav audio files in swift. Here is my code : func merge(audio1: NSURL, audio2: NSURL) { var error:NSError? var ok1 = false var ok2 = false var documentsDirectory:String = paths[0] as! String //Create AVMutableComposition Object.This object will hold our multiple AVMutableCompositionTrack. var composition = AVMutableComposition() var compositionAudioTrack1:AVMutableCompositionTrack = composition.addMutableTrackWithMediaType(AVMediaTypeAudio, preferredTrackID:

AVAudioPlayer Help: Playing multiple sounds simultaneously, stopping them all at once, and working around Automatic Reference Counting

情到浓时终转凉″ 提交于 2019-12-17 18:31:06
问题 I am trying to create buttons that play single sound files and one button that stops all of the sounds that are currently playing. If the user clicks multiple buttons or the same button in a short amount of time, the app should be playing all of the sounds simultaneously. I have accomplished this without much difficulty using the System Sound Services of iOS. However, the System Sound Services play the sounds through the volume that the iPhone's ringer is set to. I am now trying to use the