新增获取语音实时wss地址
This commit is contained in:
parent
ee501f6ecb
commit
04266912b8
@ -124,16 +124,10 @@ class XunFeiController extends BaseApiController
|
||||
header('X-Accel-Buffering: no');
|
||||
$st = microtime(true);
|
||||
|
||||
// $this->app_id = "fa185cd6";
|
||||
// $this->api_secret = "1474397d85f34828194622aab80f1e51";
|
||||
// $this->api_key = "ZjQOYjhjMmE2NmMzYzhiMjU30GE1NjJl";
|
||||
|
||||
$hostUrl = "wss://iat-api.xfyun.cn/v2/iat";
|
||||
|
||||
// $iat=new IatClient($appid,$apiKey,$apiSecret);
|
||||
$iatHostUrl = "wss://iat-api.xfyun.cn/v2/iat";
|
||||
$iat = new IatClient($this->app_id,$this->api_key,$this->api_secret);
|
||||
// halt($iat->assembleAuthUrl($hostUrl));
|
||||
$client = new Client($iat->assembleAuthUrl($hostUrl));
|
||||
// halt($iat->assembleAuthUrl($iatHostUrl));
|
||||
$client = new Client($iat->assembleAuthUrl($iatHostUrl));
|
||||
if ($client) {
|
||||
// $file = app()->getRuntimePath() . 'iat_mp3_16k.mp3';
|
||||
$file = "https://lihai001.oss-cn-chengdu.aliyuncs.com/media/iat_mp3_16k.mp3";
|
||||
@ -226,8 +220,18 @@ class XunFeiController extends BaseApiController
|
||||
} else {
|
||||
return $this->fail('无法连接到 WebSocket 服务器');
|
||||
}
|
||||
|
||||
fclose($audioFile);
|
||||
}
|
||||
|
||||
|
||||
public function iatWss()
|
||||
{
|
||||
header('X-Accel-Buffering: no');
|
||||
$iatHostUrl = "wss://iat-api.xfyun.cn/v2/iat";
|
||||
$iat = new IatClient($this->app_id,$this->api_key,$this->api_secret);
|
||||
$wssUrl = $iat->assembleAuthUrl($iatHostUrl);
|
||||
return $this->data(['wss_url' => $wssUrl]);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user