PlayThis 1.0.1

PlayThis 1.0.1

Mobile Jazz 维护。



PlayThis 1.0.1

Version Platform CocoaDocs

Mobile Jazz PlayThis

PlayThis

PlayThis 是一个播放或循环声音的库。

如何获取 PlayThis

PlayThis 添加到项目的最简单方法是使用 CocoaPods。将以下行添加到您的 Podfile 中

pod 'PlayThis', '~> 1.0'

使用 PlayThis

使用 PTSoundManager 类来管理和播放声音。首先,使用唯一键注册声音

PTSoundManager *soundManager = [[PTSoundManager alloc] init];
 
[soundManager registerFilePath:[[NSBundle mainBundle] pathForResource:@"MySound_1" ofType:@"mp3"] forKey:@"sound.1"];
[soundManager registerFilePath:[[NSBundle mainBundle] pathForResource:@"MySound_2" ofType:@"mp3"] forKey:@"sound.2"];
[soundManager registerFilePath:[[NSBundle mainBundle] pathForResource:@"MySound_3" ofType:@"mp3"] forKey:@"sound.3"];

可选地,将声音加载到内存中以便快速播放。所有声音可以一次性加载,也可以只加载其中一部分

// Load all sounds
[soundManager prepareAllSounds];

// Load only the given sounds
[soundManager prepareSoundsWithKeys:@[@"sound.2", @"sound.3"]];

最后,播放或循环声音

// Play sound 1
[soundManager playSound:@"sound.1"];

// Loop sound 2
[soundManager loopSound:@"sound.2"];

// Stop playing sound 1
[soundManager stopSound:@"sound.1"];

// Stop sound 2 loop
[soundManager stopSound:@"sound.2"];

使用方法 -isPlayingSound:-isLoopingSound: 来检查声音播放的状态。

项目维护者

本开源项目是由Joan Martin维护的。

许可证

版权所有 2016 移动爵士乐

遵循Apache许可证第2版(“许可证”);除非适用法律或书面同意,否则不得使用此文件除外。您可以在以下地址获取许可证副本:

https://apache.ac.cn/licenses/LICENSE-2.0

除非适用法律要求或书面同意,否则在此许可证下分发的软件按“按原样”提供,不提供任何形式的保证或条件,无论是明示的还是暗示的。请参阅许可证了解规范许可证权限和限制的特定语言。