File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 15031503 EZUIKitPlayer . prototype . startTalk = function ( ) {
15041504 console . log ( "执行开始对讲" ) ;
15051505 console . log ( this . opt ) ;
1506+ var _this = this ;
15061507 EZUIKit . opt = this . opt ;
1507- window . startTalk ( ) ;
1508+ var apiSuccess = function ( data ) {
1509+ if ( data . code == 200 ) {
1510+ var apiResult = data . data ;
1511+ if ( apiResult ) {
1512+ // 临时将https转换为websocket
1513+ var rtcTrunk = apiResult . rtcUrl ;
1514+ if ( rtcTrunk . indexOf ( "ws" ) === - 1 ) {
1515+ rtcTrunk = rtcTrunk . replace ( "https" , "wss" ) . replace ( "rtcgw" , "rtcgw-ws" ) ;
1516+ }
1517+ _this . opt . rtcUrl = rtcTrunk ;
1518+ _this . opt . ttsUrl = "tts://" + apiResult . ttsUrl ;
1519+ var talk = "talk://" + _this . opt . deviceSerial + ":0:" + _this . opt . channelNo + ":cas.ys7.com:6500" ;
1520+ _this . opt . talkLink = _this . opt . ttsUrl + "/" + talk ;
1521+ _this . opt . stream = apiResult . stream ;
1522+ window . startTalk ( ) ;
1523+ }
1524+ }
1525+ }
1526+ var apiError = function ( ) {
1527+ layer . msg ( "获取对讲token失败" )
1528+ }
1529+ request ( _this . opt . apiDomain , 'POST' , {
1530+ accessToken : _this . opt . accessToken ,
1531+ deviceSerial : _this . opt . deviceSerial ,
1532+ channelNo : _this . opt . channelNo
1533+ } , '' , apiSuccess , apiError ) ;
15081534 } ;
15091535
15101536 EZUIKitPlayer . prototype . stopTalk = function ( ) {
Original file line number Diff line number Diff line change 11{
22 "name" : " ezuikit-js" ,
3- "version" : " 0.2.0 " ,
3+ "version" : " 0.2.3 " ,
44 "description" : " ezuikit javascript for npm" ,
55 "main" : " ezuikit.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments