react-native-audio-api 0.4.8-rc1 → 0.4.8-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/core/AudioPlayer.m +27 -47
- package/package.json +1 -1
package/ios/core/AudioPlayer.m
CHANGED
|
@@ -8,25 +8,15 @@
|
|
|
8
8
|
self.renderAudio = [renderAudio copy];
|
|
9
9
|
self.audioEngine = [[AVAudioEngine alloc] init];
|
|
10
10
|
self.audioEngine.mainMixerNode.outputVolume = 1;
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
self.audioSession = AVAudioSession.sharedInstance;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
|
|
15
14
|
// TODO:
|
|
16
15
|
// We will probably want to change it to AVAudioSessionCategoryPlayAndRecord in the future.
|
|
17
16
|
// Eventually we to make this a dynamic setting, if user of the lib wants to use recording features.
|
|
18
17
|
// But setting a recording category might require some setup first, so lets skip it for now :)
|
|
19
|
-
[self.audioSession setCategory:AVAudioSessionCategoryPlayback error:&error];
|
|
20
|
-
|
|
21
|
-
if (error != nil) {
|
|
22
|
-
@throw error;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[self.audioSession setActive:true error:&error];
|
|
26
|
-
|
|
27
|
-
if (error != nil) {
|
|
28
|
-
@throw error;
|
|
29
|
-
}
|
|
18
|
+
// [self.audioSession setCategory:AVAudioSessionCategoryPlayback error:&error];
|
|
19
|
+
// [self.audioSession setActive:true error:&error];
|
|
30
20
|
|
|
31
21
|
self.sampleRate = [self.audioSession sampleRate];
|
|
32
22
|
|
|
@@ -34,16 +24,16 @@
|
|
|
34
24
|
|
|
35
25
|
__weak typeof(self) weakSelf = self;
|
|
36
26
|
_sourceNode = [[AVAudioSourceNode alloc] initWithFormat:self.format
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
renderBlock:^OSStatus(
|
|
28
|
+
BOOL *isSilence,
|
|
29
|
+
const AudioTimeStamp *timestamp,
|
|
30
|
+
AVAudioFrameCount frameCount,
|
|
31
|
+
AudioBufferList *outputData) {
|
|
32
|
+
return [weakSelf renderCallbackWithIsSilence:isSilence
|
|
33
|
+
timestamp:timestamp
|
|
34
|
+
frameCount:frameCount
|
|
35
|
+
outputData:outputData];
|
|
36
|
+
}];
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
return self;
|
|
@@ -57,23 +47,13 @@
|
|
|
57
47
|
self.audioEngine.mainMixerNode.outputVolume = 1;
|
|
58
48
|
|
|
59
49
|
self.audioSession = AVAudioSession.sharedInstance;
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
|
|
62
51
|
// TODO:
|
|
63
52
|
// We will probably want to change it to AVAudioSessionCategoryPlayAndRecord in the future.
|
|
64
53
|
// Eventually we to make this a dynamic setting, if user of the lib wants to use recording features.
|
|
65
54
|
// But setting a recording category might require some setup first, so lets skip it for now :)
|
|
66
|
-
[self.audioSession setCategory:AVAudioSessionCategoryPlayback error:&error];
|
|
67
|
-
|
|
68
|
-
if (error != nil) {
|
|
69
|
-
@throw error;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
[self.audioSession setActive:true error:&error];
|
|
73
|
-
|
|
74
|
-
if (error != nil) {
|
|
75
|
-
@throw error;
|
|
76
|
-
}
|
|
55
|
+
// [self.audioSession setCategory:AVAudioSessionCategoryPlayback error:&error];
|
|
56
|
+
// [self.audioSession setActive:true error:&error];
|
|
77
57
|
|
|
78
58
|
self.sampleRate = sampleRate;
|
|
79
59
|
|
|
@@ -81,16 +61,16 @@
|
|
|
81
61
|
|
|
82
62
|
__weak typeof(self) weakSelf = self;
|
|
83
63
|
_sourceNode = [[AVAudioSourceNode alloc] initWithFormat:self.format
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
64
|
+
renderBlock:^OSStatus(
|
|
65
|
+
BOOL *isSilence,
|
|
66
|
+
const AudioTimeStamp *timestamp,
|
|
67
|
+
AVAudioFrameCount frameCount,
|
|
68
|
+
AudioBufferList *outputData) {
|
|
69
|
+
return [weakSelf renderCallbackWithIsSilence:isSilence
|
|
70
|
+
timestamp:timestamp
|
|
71
|
+
frameCount:frameCount
|
|
72
|
+
outputData:outputData];
|
|
73
|
+
}];
|
|
94
74
|
}
|
|
95
75
|
|
|
96
76
|
return self;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-audio-api",
|
|
3
|
-
"version": "0.4.8-
|
|
3
|
+
"version": "0.4.8-rc2",
|
|
4
4
|
"description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|