From 6059b6c1b4bd306c40056f69859903a25d5fee01 Mon Sep 17 00:00:00 2001 From: Keith Yao Date: Fri, 5 Jun 2015 09:31:16 +0800 Subject: [PATCH 1/3] [RN] export RNDouAudioStreamer for react native --- index.js | 14 ++++ package.json | 22 ++++++ src/RNDouAudioStreamer.h | 14 ++++ src/RNDouAudioStreamer.m | 158 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 index.js create mode 100644 package.json create mode 100644 src/RNDouAudioStreamer.h create mode 100644 src/RNDouAudioStreamer.m diff --git a/index.js b/index.js new file mode 100644 index 0000000..0545824 --- /dev/null +++ b/index.js @@ -0,0 +1,14 @@ +'use strict'; + +var Streamer = require('NativeModules').RADOUAudioStreamer; + +class DouAudio {} + +DouAudio.createSound = function (options) { + Streamer.createSound(options, function (error, id) { + console.log(arguments); + return Streamer.play(id); + }); +} + +module.exports = DouAudio; diff --git a/package.json b/package.json new file mode 100644 index 0000000..c3bc625 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "DOUAudioStreamer", + "version": "1.0.0", + "description": "DOUAudioStreamer is a Core Audio based streaming audio player for iOS/Mac.", + "main": "index.js", + "directories": { + "example": "example" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/douban/DOUAudioStreamer.git" + }, + "author": "Keith Yao (http://about.me/yaofur)", + "license": "ISC", + "bugs": { + "url": "https://github.com/douban/DOUAudioStreamer/issues" + }, + "homepage": "https://github.com/douban/DOUAudioStreamer" +} diff --git a/src/RNDouAudioStreamer.h b/src/RNDouAudioStreamer.h new file mode 100644 index 0000000..3cfca61 --- /dev/null +++ b/src/RNDouAudioStreamer.h @@ -0,0 +1,14 @@ +// +// SocketBridge.h +// DouAudioStreamer +// +// Created by Keith Yao on 29/05/2015. +// Copyright (c) 2015 Douban. All rights reserved. +// + +#import "RCTBridgeModule.h" +#import "RCTLog.h" + +@interface RADOUAudioStreamer : NSObject + +@end \ No newline at end of file diff --git a/src/RNDouAudioStreamer.m b/src/RNDouAudioStreamer.m new file mode 100644 index 0000000..1aae9a5 --- /dev/null +++ b/src/RNDouAudioStreamer.m @@ -0,0 +1,158 @@ +// +// SocketBridge.h +// DouAudioStreamer +// +// Created by Keith Yao on 29/05/2015. +// Copyright (c) 2015 Douban. All rights reserved. +// +#import "RNDouAudioStreamer.h" +#import "DOUAudioStreamer.h" +#import "DOUAudioStreamer+Options.h" +#import "Track.h" + +#import "RCTConvert.h" +#import "RCTBridge.h" +#import "RCTUtils.h" +#import "RCTEventDispatcher.h" + +static void *kStatusKVOKey = &kStatusKVOKey; +static void *kDurationKVOKey = &kDurationKVOKey; +static void *kBufferingRatioKVOKey = &kBufferingRatioKVOKey; + +@implementation RADOUAudioStreamer { + NSMutableDictionary *_sounds ; +} + +@synthesize bridge = _bridge; + +- (instancetype)init { + [DOUAudioStreamer setOptions:[DOUAudioStreamer options] | DOUAudioStreamerRequireSHA256]; + _sounds = [NSMutableDictionary dictionaryWithDictionary:@{}]; + return self; +} + +- (DOUAudioStreamer *) getSoundWithName: (NSString *) name +{ + return [_sounds objectForKey:name]; +} + +- (void) createSoundWithName: (NSString *) name andValue: (DOUAudioStreamer *) audio { + [_sounds setObject:audio forKey:name]; +} + +- (NSString *) uniqueId { + CFUUIDRef uuidRef = CFUUIDCreate(NULL); + CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef); + CFRelease(uuidRef); + return (__bridge_transfer NSString *)uuidStringRef; +} + +RCT_EXPORT_MODULE(); + +RCT_EXPORT_METHOD(createSound: (NSDictionary *) song + done: (RCTResponseSenderBlock) callback) +{ + Track *track = [[Track alloc] init]; + [track setArtist:[song objectForKey:@"artist"]]; + [track setTitle:[song objectForKey:@"title"]]; + [track setAudioFileURL:[NSURL URLWithString:[song objectForKey:@"url"]]]; + id streamer = [DOUAudioStreamer streamerWithAudioFile:track]; + + NSString * audioName = [self uniqueId]; + [self createSoundWithName:audioName andValue: streamer]; + + // add observers + [streamer addObserver:self + forKeyPath:@"status" + options:NSKeyValueObservingOptionNew + context:kStatusKVOKey]; + + [streamer addObserver:self + forKeyPath:@"duration" + options:NSKeyValueObservingOptionNew + context:kDurationKVOKey]; + + [streamer addObserver:self + forKeyPath:@"bufferingRatio" + options:NSKeyValueObservingOptionNew + context:kBufferingRatioKVOKey]; + // end observers + + callback(@[[NSNull null], audioName]); +} + +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context +{ + // NSString * eventName = @"what"; + DOUAudioStreamer * streamer = object; + NSString * soundId; + NSArray * names = [_sounds allKeysForObject: streamer]; + if(names.count >= 1) { + soundId = names[0]; + } + + if (context == kStatusKVOKey) { + //[self performSelector:@selector(_updateStatus) + //onThread:[NSThread mainThread] + //withObject:nil + //waitUntilDone:NO]; + } + else if (context == kDurationKVOKey) { + //[self performSelector:@selector(_timerAction:) + //onThread:[NSThread mainThread] + //withObject:nil + //waitUntilDone:NO]; + } + else if (context == kBufferingRatioKVOKey) { + //[self performSelector:@selector(_updateBufferingStatus) + //onThread:[NSThread mainThread] + //withObject:nil + //waitUntilDone:NO]; + } + else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } + + [[[self bridge] eventDispatcher] sendAppEventWithName:@"EventAudio" + body:@{@"name": eventName}]; +} + +RCT_EXPORT_METHOD(pause: (NSString *) name){ + DOUAudioStreamer * streamer = [self getSoundWithName:name]; + if(streamer){ + [streamer pause]; + } +} + +RCT_EXPORT_METHOD(play: (NSString *) name){ + DOUAudioStreamer * streamer = [self getSoundWithName:name]; + if(streamer){ + [streamer play]; + } +} + +RCT_EXPORT_METHOD(stop: (NSString *) name){ + DOUAudioStreamer * streamer = [self getSoundWithName:name]; + if(streamer){ + [streamer play]; + } +} + +// NSTimeInterval is double +RCT_EXPORT_METHOD(setCurrentTime: (NSTimeInterval) time){ + // return [_audioStreamer setCurrentTime: time]; +} + +RCT_EXPORT_METHOD(duration){ + // return [_audioStreamer duration]; +} + +RCT_EXPORT_METHOD(currentTime){ +} + +RCT_EXPORT_METHOD(status){} + +@end From b346de8514ca39883aac7a0764cf15482c1c4bfb Mon Sep 17 00:00:00 2001 From: Keith Yao Date: Thu, 11 Jun 2015 01:24:42 +0800 Subject: [PATCH 2/3] [RN] trigger playing event to js --- .gitignore | 3 + index.js | 63 ++++++++++++++++-- package.json | 6 +- src/RCTDouAudioTrack.h | 26 ++++++++ src/RCTDouAudioTrack.m | 21 ++++++ src/RNDouAudioStreamer.m | 139 ++++++++++++++++++++++++++++++--------- 6 files changed, 222 insertions(+), 36 deletions(-) create mode 100644 src/RCTDouAudioTrack.h create mode 100644 src/RCTDouAudioTrack.m diff --git a/.gitignore b/.gitignore index e7dd37c..5777b74 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ build/ *~ *.dat *.dep + +# react native related +node_modules/ diff --git a/index.js b/index.js index 0545824..e3dc0b8 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,68 @@ 'use strict'; +// var Promise = require('promise'); +var { DeviceEventEmitter } = require('react-native'); var Streamer = require('NativeModules').RADOUAudioStreamer; +var {EventEmitter} = require('events'); -class DouAudio {} +class DouAudio extends EventEmitter { + + constructor(id) { + super(); + + this.id = id; + + this.nativeEventSubscription = DeviceEventEmitter.addListener( + "EventAudio-" + this.id, + this._dispatchEvent.bind(this) + ); + + Object.assign(this, { + bufferingRatio: null, + bytesLoaded: null, + bytesTotal: null, + downloadSpeed: null, + + position: null, + duration: null, + + // 0 = stopped/uninitialised + // 1 = playing or buffering sound (play has been called, waiting for data etc.) + playState: 0, + + // Numeric value indicating a sound's current load status + // 0 = uninitialised + // 1 = loading + // 2 = failed/error + // 3 = loaded/success + readyState: 0, + + paused: true + }); + + } + + _dispatchEvent(o) { + // {name, data} + console.log(o); + Object.assign(this, o.data); + this.emit(o.name, o.data); + } + + destruct() { + // @todo tell the objc to destroy the sound + this.nativeEventSubscription.remove(); + } +} + +DouAudio.createSound = function (options, callback) { + // pollingInterval -DouAudio.createSound = function (options) { Streamer.createSound(options, function (error, id) { - console.log(arguments); - return Streamer.play(id); + // console.log(arguments); + Streamer.play(id); + var audio = new DouAudio(id); + callback && callback(audio); }); } diff --git a/package.json b/package.json index c3bc625..5a2b5c4 100644 --- a/package.json +++ b/package.json @@ -18,5 +18,9 @@ "bugs": { "url": "https://github.com/douban/DOUAudioStreamer/issues" }, - "homepage": "https://github.com/douban/DOUAudioStreamer" + "homepage": "https://github.com/douban/DOUAudioStreamer", + "dependencies": { + "events": "^1.0.2", + "promise": "^7.0.1" + } } diff --git a/src/RCTDouAudioTrack.h b/src/RCTDouAudioTrack.h new file mode 100644 index 0000000..0f4c58e --- /dev/null +++ b/src/RCTDouAudioTrack.h @@ -0,0 +1,26 @@ +/* vim: set ft=objc fenc=utf-8 sw=2 ts=2 et: */ +/* + * DOUAudioStreamer - A Core Audio based streaming audio player for iOS/Mac: + * + * https://github.com/douban/DOUAudioStreamer + * + * Copyright 2013-2014 Douban Inc. All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the LICENSE file for full text. + * + * Authors: + * Chongyu Zhu + * + */ + +#import +#import "DOUAudioFile.h" + +@interface Track : NSObject + +@property (nonatomic, strong) NSString *artist; +@property (nonatomic, strong) NSString *title; +@property (nonatomic, strong) NSURL *audioFileURL; + +@end diff --git a/src/RCTDouAudioTrack.m b/src/RCTDouAudioTrack.m new file mode 100644 index 0000000..d941bc7 --- /dev/null +++ b/src/RCTDouAudioTrack.m @@ -0,0 +1,21 @@ +/* vim: set ft=objc fenc=utf-8 sw=2 ts=2 et: */ +/* + * DOUAudioStreamer - A Core Audio based streaming audio player for iOS/Mac: + * + * https://github.com/douban/DOUAudioStreamer + * + * Copyright 2013-2014 Douban Inc. All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the LICENSE file for full text. + * + * Authors: + * Chongyu Zhu + * + */ + +#import "Track.h" + +@implementation Track + +@end diff --git a/src/RNDouAudioStreamer.m b/src/RNDouAudioStreamer.m index 1aae9a5..10bb0cd 100644 --- a/src/RNDouAudioStreamer.m +++ b/src/RNDouAudioStreamer.m @@ -20,7 +20,9 @@ static void *kBufferingRatioKVOKey = &kBufferingRatioKVOKey; @implementation RADOUAudioStreamer { - NSMutableDictionary *_sounds ; +@private + NSTimer * _timer; + NSMutableDictionary *_sounds; } @synthesize bridge = _bridge; @@ -47,6 +49,35 @@ - (NSString *) uniqueId { return (__bridge_transfer NSString *)uuidStringRef; } +- (void) _emitEvent:(NSString *) eventName + withValue: (NSDictionary *) eventValue + andSoundId: (NSString *) soundId +{ + NSDictionary * body = @{@"name": eventName, + @"value": eventValue}; + + NSString * nativeEventName = [NSString stringWithFormat:@"EventAudio-%@", soundId]; + + NSLog(@"fire event:%@", nativeEventName); + + [self.bridge.eventDispatcher + sendDeviceEventWithName:nativeEventName + body:body]; +} + +- (void) _whilePlaying: (id)timer + +{ + DOUAudioStreamer * streamer = [[timer userInfo] valueForKey: @"streamer"]; + NSString * soundId = [[timer userInfo] valueForKey:@"id"]; + NSString * eventName = @"whileplaying"; + NSDictionary * eventValue = @{ + @"position": @([streamer currentTime]), + @"duration": @([streamer duration]) + }; + [self _emitEvent:eventName withValue:eventValue andSoundId:soundId]; +} + RCT_EXPORT_MODULE(); RCT_EXPORT_METHOD(createSound: (NSDictionary *) song @@ -57,7 +88,15 @@ - (NSString *) uniqueId { [track setTitle:[song objectForKey:@"title"]]; [track setAudioFileURL:[NSURL URLWithString:[song objectForKey:@"url"]]]; id streamer = [DOUAudioStreamer streamerWithAudioFile:track]; - + int oPollingInterval = [[song objectForKey: @"pollingInterval"] doubleValue]; + + if(oPollingInterval < 1){ + // set the default value + oPollingInterval = 1000; + } + + NSTimeInterval pollingInterval = oPollingInterval / 1000; + NSString * audioName = [self uniqueId]; [self createSoundWithName:audioName andValue: streamer]; @@ -77,7 +116,16 @@ - (NSString *) uniqueId { options:NSKeyValueObservingOptionNew context:kBufferingRatioKVOKey]; // end observers - + + // @todo add _timer for all playing audios + dispatch_async(dispatch_get_main_queue(), ^{ + _timer = [NSTimer scheduledTimerWithTimeInterval:pollingInterval + target:self + selector: @selector(_whilePlaying:) + userInfo: @{@"streamer": streamer, @"id": audioName} + repeats: YES]; + }); + callback(@[[NSNull null], audioName]); } @@ -86,7 +134,9 @@ - (void)observeValueForKeyPath:(NSString *)keyPath change:(NSDictionary *)change context:(void *)context { - // NSString * eventName = @"what"; + NSString * eventName; + NSDictionary * eventValue; + DOUAudioStreamer * streamer = object; NSString * soundId; NSArray * names = [_sounds allKeysForObject: streamer]; @@ -95,29 +145,63 @@ - (void)observeValueForKeyPath:(NSString *)keyPath } if (context == kStatusKVOKey) { - //[self performSelector:@selector(_updateStatus) - //onThread:[NSThread mainThread] - //withObject:nil - //waitUntilDone:NO]; + switch (streamer.status) { + case DOUAudioStreamerPlaying: + eventName = @"play"; + break; + case DOUAudioStreamerPaused: + eventName = @"pause"; + break; + case DOUAudioStreamerIdle: + eventName = @"idle"; + break; + case DOUAudioStreamerFinished: + eventName = @"finish"; + break; + case DOUAudioStreamerBuffering: + eventName = @"buffering"; + break; + case DOUAudioStreamerError: + eventName = @"error"; + break; + default: + break; + } + eventValue = @{}; } else if (context == kDurationKVOKey) { - //[self performSelector:@selector(_timerAction:) - //onThread:[NSThread mainThread] - //withObject:nil - //waitUntilDone:NO]; + eventName = @"whileplaying"; + eventValue = @{ + @"position": @([streamer currentTime]), + @"duration": @([streamer duration]) + }; } else if (context == kBufferingRatioKVOKey) { - //[self performSelector:@selector(_updateBufferingStatus) - //onThread:[NSThread mainThread] - //withObject:nil - //waitUntilDone:NO]; + eventName = @"whileloading"; + eventValue = @{ + @"bufferingRatio": @([streamer bufferingRatio]), + @"bytesLoaded": @([streamer receivedLength]), + @"bytesTotal": @([streamer expectedLength]), + @"downloadSpeed": @([streamer downloadSpeed]) + }; } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + return; } - - [[[self bridge] eventDispatcher] sendAppEventWithName:@"EventAudio" - body:@{@"name": eventName}]; + + NSDictionary * body = @{ + @"name": eventName, + @"value": eventValue + }; + + NSString * nativeEventName = [NSString stringWithFormat:@"EventAudio-%@", soundId]; + + NSLog(@"fire event:%@", nativeEventName); + + [self.bridge.eventDispatcher + sendDeviceEventWithName:nativeEventName + body:body]; } RCT_EXPORT_METHOD(pause: (NSString *) name){ @@ -142,17 +226,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath } // NSTimeInterval is double -RCT_EXPORT_METHOD(setCurrentTime: (NSTimeInterval) time){ - // return [_audioStreamer setCurrentTime: time]; -} - -RCT_EXPORT_METHOD(duration){ - // return [_audioStreamer duration]; -} - -RCT_EXPORT_METHOD(currentTime){ +RCT_EXPORT_METHOD(setCurrentTime: (NSString *) name andTime: (NSTimeInterval) time){ + DOUAudioStreamer * streamer = [self getSoundWithName:name]; + if(streamer){ + [streamer setCurrentTime: time]; + } } - -RCT_EXPORT_METHOD(status){} - @end From 2948ba506775376f8db8dbf52a59b7c3ac3afa92 Mon Sep 17 00:00:00 2001 From: Keith Yao Date: Sat, 13 Jun 2015 02:56:02 +0800 Subject: [PATCH 3/3] pass js-event by eventEmitter improve CurrentPlaying event, add RNDouAudioTrack --- index.js | 19 ++++-- src/RNDouAudioStreamer.m | 62 +++++++++++++------ src/{RCTDouAudioTrack.h => RNDouAudioTrack.h} | 0 src/{RCTDouAudioTrack.m => RNDouAudioTrack.m} | 2 +- 4 files changed, 56 insertions(+), 27 deletions(-) rename src/{RCTDouAudioTrack.h => RNDouAudioTrack.h} (100%) rename src/{RCTDouAudioTrack.m => RNDouAudioTrack.m} (93%) diff --git a/index.js b/index.js index e3dc0b8..2ac1f60 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,6 @@ class DouAudio extends EventEmitter { constructor(id) { super(); - this.id = id; this.nativeEventSubscription = DeviceEventEmitter.addListener( @@ -40,27 +39,35 @@ class DouAudio extends EventEmitter { paused: true }); + for(let command of ['play', 'pause', 'stop', 'setPosition']) { + this[command] = (...args) => { + return Streamer[command].call(this, this.id, ...args); + } + } + } _dispatchEvent(o) { - // {name, data} console.log(o); - Object.assign(this, o.data); - this.emit(o.name, o.data); + Object.assign(this, o.value); + this.emit(o.name, o.value); } destruct() { // @todo tell the objc to destroy the sound this.nativeEventSubscription.remove(); + Streamer.destruct(this.id); } + } DouAudio.createSound = function (options, callback) { // pollingInterval - Streamer.createSound(options, function (error, id) { // console.log(arguments); - Streamer.play(id); + if(options.autoPlay){ + Streamer.play(id); + } var audio = new DouAudio(id); callback && callback(audio); }); diff --git a/src/RNDouAudioStreamer.m b/src/RNDouAudioStreamer.m index 10bb0cd..387d440 100644 --- a/src/RNDouAudioStreamer.m +++ b/src/RNDouAudioStreamer.m @@ -8,7 +8,7 @@ #import "RNDouAudioStreamer.h" #import "DOUAudioStreamer.h" #import "DOUAudioStreamer+Options.h" -#import "Track.h" +#import "RNDouAudioTrack.h" #import "RCTConvert.h" #import "RCTBridge.h" @@ -30,6 +30,19 @@ @implementation RADOUAudioStreamer { - (instancetype)init { [DOUAudioStreamer setOptions:[DOUAudioStreamer options] | DOUAudioStreamerRequireSHA256]; _sounds = [NSMutableDictionary dictionaryWithDictionary:@{}]; + + dispatch_async( + dispatch_get_main_queue(), + // [self methodQueue], + //dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), + ^{ + _timer = [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector: @selector(_whilePlaying:) + userInfo: nil + repeats: YES]; + }); + return self; } @@ -68,14 +81,17 @@ - (void) _emitEvent:(NSString *) eventName - (void) _whilePlaying: (id)timer { - DOUAudioStreamer * streamer = [[timer userInfo] valueForKey: @"streamer"]; - NSString * soundId = [[timer userInfo] valueForKey:@"id"]; - NSString * eventName = @"whileplaying"; - NSDictionary * eventValue = @{ - @"position": @([streamer currentTime]), - @"duration": @([streamer duration]) - }; - [self _emitEvent:eventName withValue:eventValue andSoundId:soundId]; + [_sounds enumerateKeysAndObjectsUsingBlock:^(NSString * soundId, DOUAudioStreamer * streamer, BOOL *stop) { + if(streamer.status != DOUAudioStreamerPlaying) { + return; + } + NSString * eventName = @"whileplaying"; + NSDictionary * eventValue = @{ + @"position": @([streamer currentTime] * 1000), + @"duration": @([streamer duration] * 1000) + }; + [self _emitEvent:eventName withValue:eventValue andSoundId:soundId]; + }]; } RCT_EXPORT_MODULE(); @@ -88,14 +104,14 @@ - (void) _whilePlaying: (id)timer [track setTitle:[song objectForKey:@"title"]]; [track setAudioFileURL:[NSURL URLWithString:[song objectForKey:@"url"]]]; id streamer = [DOUAudioStreamer streamerWithAudioFile:track]; - int oPollingInterval = [[song objectForKey: @"pollingInterval"] doubleValue]; + /* + int oPollingInterval = [[song objectForKey: @"pollingInterval"] doubleValue]; if(oPollingInterval < 1){ // set the default value oPollingInterval = 1000; } - - NSTimeInterval pollingInterval = oPollingInterval / 1000; + NSTimeInterval pollingInterval = oPollingInterval / 1000; */ NSString * audioName = [self uniqueId]; [self createSoundWithName:audioName andValue: streamer]; @@ -118,17 +134,23 @@ - (void) _whilePlaying: (id)timer // end observers // @todo add _timer for all playing audios - dispatch_async(dispatch_get_main_queue(), ^{ - _timer = [NSTimer scheduledTimerWithTimeInterval:pollingInterval - target:self - selector: @selector(_whilePlaying:) - userInfo: @{@"streamer": streamer, @"id": audioName} - repeats: YES]; - }); + callback(@[[NSNull null], audioName]); } +RCT_EXPORT_METHOD(destructSound: (NSString *) name){ + DOUAudioStreamer * streamer = [self getSoundWithName:name]; + if(streamer == nil){ + return; + } + [streamer pause]; + [streamer removeObserver:self forKeyPath:@"status"]; + [streamer removeObserver:self forKeyPath:@"duration"]; + [streamer removeObserver:self forKeyPath:@"bufferingRatio"]; + [_sounds removeObjectForKey:name]; +} + - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change @@ -226,7 +248,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath } // NSTimeInterval is double -RCT_EXPORT_METHOD(setCurrentTime: (NSString *) name andTime: (NSTimeInterval) time){ +RCT_EXPORT_METHOD(setPosition: (NSString *) name andTime: (NSTimeInterval) time){ DOUAudioStreamer * streamer = [self getSoundWithName:name]; if(streamer){ [streamer setCurrentTime: time]; diff --git a/src/RCTDouAudioTrack.h b/src/RNDouAudioTrack.h similarity index 100% rename from src/RCTDouAudioTrack.h rename to src/RNDouAudioTrack.h diff --git a/src/RCTDouAudioTrack.m b/src/RNDouAudioTrack.m similarity index 93% rename from src/RCTDouAudioTrack.m rename to src/RNDouAudioTrack.m index d941bc7..82b9c9d 100644 --- a/src/RCTDouAudioTrack.m +++ b/src/RNDouAudioTrack.m @@ -14,7 +14,7 @@ * */ -#import "Track.h" +#import "RNDouAudioTrack.h" @implementation Track