diff --git a/README.md b/README.md index 7f80cf4..67fa13e 100644 --- a/README.md +++ b/README.md @@ -2,40 +2,10 @@ ## 安装方法 -下载插件与官方SDK,android与ios的SDK需要分别建立项目下载SDK +APP_KEY参数值为您在科大讯飞申请的appid -下载之后找到插件下 - -ios目录:src/ios - -android目录:src/android/libs - - -然后将SDK目录下 - -ios SDK:lib/iflyMSC.framework - -android SDK:libs - -分别替换插件的ios目录和android目录中的文件 - -将android SDK assets\iflytek目录中的文件替换插件中src/android/assets/iflytek路径下的文件 - - - - -然后修改plugin.xml, -搜索app_id,将后面的值换成自己申请的appid, -搜索appkey,将后面的值换成自己申请的appid - -修改res/values/strings.xml, -搜索appid,将后面的值换成自己申请的appid - -修改src/ios/CDVSpeech.m, -搜索app_id,将后面的值换成自己申请的appid - -运行cordova plugin add [插件的绝对路径] +运行cordova plugin add https://gitee.com/shuto/cordova-plugin-IFlyspeech-master.git --variable APP_KEY=${APP_KEY} ## 调用方法 diff --git a/plugin.xml b/plugin.xml index 566c76c..af53cbb 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,8 @@ cordova-plugin-xunfeiListenSpeaking - + + @@ -28,10 +29,10 @@ + android:value="$APP_KEY" /> + android:value="$CHANNEL" /> @@ -82,7 +83,7 @@ - 584e7225 + $APP_KEY 本示例为讯飞语音Android平台开发者提供语音听写、语法识别、语义理解和语音合成等代码样例,旨在让用户能够依据该示例快速开发出基于语音接口的应用程序。 科大讯飞作为中国最大的智能语音技术提供商,在智能语音技术领域有着长期的研究积累,并在中文语音合成、语音识别、口语评测等多项技术上拥有国际领先的成果。科大讯飞是我国唯一以语音技术为产业化方向的“国家863计划成果产业化基地”… iFLYTEK is a national key software enterprise dedicated to the research of intelligent speech and language technologies, development of software and chip products, provision of speech information services, and integration of E-government systems. The intelligent speech technology of iFLYTEK, the core technology of the company, represents the top level in the world. @@ -246,7 +247,7 @@ - + @@ -267,9 +268,11 @@ - - - + + + + $APP_KEY + diff --git a/src/ios/CDVSpeech.m b/src/ios/CDVSpeech.m index 56146da..f2d1669 100644 --- a/src/ios/CDVSpeech.m +++ b/src/ios/CDVSpeech.m @@ -17,7 +17,7 @@ #define STR_PROGRESS @"progress" // always replace the appid and the SDK with what you get from voicecloud.cn -#define SPEECH_APP_ID @"589d270d" +// static SPEECH_APP_ID; @interface CDVSpeech() @@ -30,14 +30,25 @@ - (void)login:(CDVInvokedUrlCommand*)command { self.callbackId = command.callbackId; - - self.appId = SPEECH_APP_ID; + if(self.appId == nil) { + NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"IFlySpeechConfig" ofType:@"plist"]; + if (plistPath == nil) { + NSLog(@"error: IFlySpeechConfig.plist not found"); + assert(0); + } + self.appId = [plistData valueForKey:@"AppKey"]; + } NSString *initString = [[NSString alloc] initWithFormat:@"appid=%@",self.appId]; [IFlySpeechUtility createUtility:initString]; } +- (void) loadAppID{ + + NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath]; +} + #pragma mark - 语音录入 - (void)startListening:(CDVInvokedUrlCommand*)command { diff --git a/src/ios/IFlySpeechConfig.plist b/src/ios/IFlySpeechConfig.plist new file mode 100644 index 0000000..6589a9d --- /dev/null +++ b/src/ios/IFlySpeechConfig.plist @@ -0,0 +1,8 @@ + + + + + AppKey + + +