Skip to content

Commit d7dda8a

Browse files
committed
feat(audio): ogg & opus support for ios
1 parent 844fbab commit d7dda8a

42 files changed

Lines changed: 2300 additions & 7 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
5.17 MB
Binary file not shown.

apps/demo/src/plugin-demos/audio-context.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ export function canvasReady(args: EventData) {
1111
const page = canvas.page as Page;
1212
const ctx = page.bindingContext as any;
1313
if (ctx && ctx.initVisualizer) ctx.initVisualizer(canvas);
14-
setTimeout(() => {
15-
playSample(args);
16-
}, 6000);
1714
}
1815

1916
export function playSample(args: EventData) {
2017
const page = (<any>args.object).page as Page;
2118
const ctx = page.bindingContext as any;
22-
const testPath = '~/assets/file-assets/audio/gs-16b-1c-44100hz.wav';
19+
// const testPath = '~/assets/file-assets/audio/gs-16b-1c-44100hz.wav';
20+
const testPath = '~/assets/file-assets/audio/ogg_sample.ogg';
2321
const resolvedPath = testPath.startsWith('~/') ? testPath.replace('~/', knownFolders.currentApp().path + '/') : testPath;
2422
if (ctx && ctx.playUrl) {
2523
const p = ctx.playUrl(resolvedPath);

packages/audio-context/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/audio-context",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "Web Audio API for NativeScript",
55
"main": "index",
66
"types": "index.d.ts",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>AvailableLibraries</key>
6+
<array>
7+
<dict>
8+
<key>BinaryPath</key>
9+
<string>AudioContextNative.framework/AudioContextNative</string>
10+
<key>LibraryIdentifier</key>
11+
<string>ios-arm64</string>
12+
<key>LibraryPath</key>
13+
<string>AudioContextNative.framework</string>
14+
<key>SupportedArchitectures</key>
15+
<array>
16+
<string>arm64</string>
17+
</array>
18+
<key>SupportedPlatform</key>
19+
<string>ios</string>
20+
</dict>
21+
<dict>
22+
<key>BinaryPath</key>
23+
<string>AudioContextNative.framework/AudioContextNative</string>
24+
<key>LibraryIdentifier</key>
25+
<string>ios-arm64_x86_64-simulator</string>
26+
<key>LibraryPath</key>
27+
<string>AudioContextNative.framework</string>
28+
<key>SupportedArchitectures</key>
29+
<array>
30+
<string>arm64</string>
31+
<string>x86_64</string>
32+
</array>
33+
<key>SupportedPlatform</key>
34+
<string>ios</string>
35+
<key>SupportedPlatformVariant</key>
36+
<string>simulator</string>
37+
</dict>
38+
</array>
39+
<key>CFBundlePackageType</key>
40+
<string>XFWK</string>
41+
<key>XCFrameworkFormatVersion</key>
42+
<string>1.0</string>
43+
</dict>
44+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// AudioContextNative.h
3+
// AudioContextNative
4+
//
5+
// Created by Osei Fortune on 30/04/2026.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
//! Project version number for AudioContextNative.
11+
FOUNDATION_EXPORT double AudioContextNativeVersionNumber;
12+
13+
//! Project version string for AudioContextNative.
14+
FOUNDATION_EXPORT const unsigned char AudioContextNativeVersionString[];
15+
16+
// In this header, you should import all the public headers of your framework using statements like #import <AudioContextNative/PublicHeader.h>
17+
#import <AudioContextNative/NSCOpusDecoder.h>
18+
#import <AudioContextNative/NSCVorbisDecoder.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// NSCOpusDecoder.h
3+
// AudioContextNative
4+
//
5+
6+
#import <Foundation/Foundation.h>
7+
#import <AVFoundation/AVFoundation.h>
8+
9+
NS_ASSUME_NONNULL_BEGIN
10+
11+
@interface NSCOpusDecoder : NSObject
12+
13+
+ (nullable AVAudioPCMBuffer *)decodeOpusData:(NSData *)data;
14+
15+
+ (nullable AVAudioPCMBuffer *)decodeOpusFile:(NSString *)path;
16+
17+
@end
18+
19+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// NSCVorbisDecoder.h
3+
// AudioContextNative
4+
//
5+
6+
#import <Foundation/Foundation.h>
7+
#import <AVFoundation/AVFoundation.h>
8+
9+
NS_ASSUME_NONNULL_BEGIN
10+
11+
@interface NSCVorbisDecoder : NSObject
12+
13+
+ (nullable AVAudioPCMBuffer *)decodeVorbisData:(NSData *)data;
14+
15+
+ (nullable AVAudioPCMBuffer *)decodeVorbisFile:(NSString *)path;
16+
17+
@end
18+
19+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
framework module AudioContextNative {
2+
umbrella header "AudioContextNative.h"
3+
export *
4+
5+
module * { export * }
6+
}

0 commit comments

Comments
 (0)