trtc-sdk-v5 5.14.2-beta.2 → 5.14.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/debug-dialog.js +1 -1
- package/index.d.ts +43 -0
- package/package.json +1 -1
- package/plugins/cdn-streaming/package.json +1 -1
- package/plugins/chorus/package.json +1 -1
- package/plugins/cross-room/package.json +1 -1
- package/plugins/custom-encryption/custom-encryption.esm.js +1 -1
- package/plugins/custom-encryption/custom-encryption.umd.js +1 -1
- package/plugins/custom-encryption/package.json +1 -1
- package/plugins/device-detector/package.json +1 -1
- package/plugins/{video-effect/face-detection → realtime-transcriber}/package.json +8 -8
- package/plugins/realtime-transcriber/realtime-transcriber.esm.d.ts +16 -0
- package/plugins/realtime-transcriber/realtime-transcriber.esm.js +1 -0
- package/plugins/realtime-transcriber/realtime-transcriber.umd.js +1 -0
- package/plugins/small-stream-auto-switcher/package.json +1 -1
- package/plugins/video-decoder/package.json +1 -1
- package/plugins/video-decoder/video-decoder.esm.js +1 -1
- package/plugins/video-decoder/video-decoder.umd.js +1 -1
- package/plugins/video-effect/basic-beauty/package.json +1 -1
- package/plugins/video-effect/beauty/package.json +1 -1
- package/plugins/video-effect/video-mixer/package.json +1 -1
- package/plugins/video-effect/virtual-background/package.json +1 -1
- package/plugins/video-effect/virtual-background/virtual-background.esm.js +1 -1
- package/plugins/video-effect/virtual-background/virtual-background.umd.js +1 -1
- package/plugins/video-effect/watermark/package.json +1 -1
- package/plugins/voice-changer/package.json +1 -1
- package/trtc.esm.js +29 -29
- package/trtc.js +1 -1
- package/plugins/video-effect/face-detection/face-detection.esm.d.ts +0 -13
- package/plugins/video-effect/face-detection/face-detection.esm.js +0 -1
- package/plugins/video-effect/face-detection/face-detection.umd.js +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@rtc-plugin/
|
|
3
|
-
"version": "5.14.2-beta.
|
|
4
|
-
"description": "TRTC Web SDK 5.x
|
|
5
|
-
"main": "./
|
|
6
|
-
"module": "./
|
|
2
|
+
"name": "@rtc-plugin/realtime-transcriber",
|
|
3
|
+
"version": "5.14.2-beta.3",
|
|
4
|
+
"description": "TRTC Web SDK 5.x Realtime Transcriber plugin",
|
|
5
|
+
"main": "./realtime-transcriber.esm.js",
|
|
6
|
+
"module": "./realtime-transcriber.esm.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git@github.com:LiteAVSDK/TRTC_Web.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/tutorial-
|
|
11
|
+
"homepage": "https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/tutorial-30-advanced-realtime-transcriber-link.html",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"webrtc",
|
|
14
14
|
"TRTC",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"microphone",
|
|
24
24
|
"live streaming",
|
|
25
25
|
"real-time communication",
|
|
26
|
-
"
|
|
26
|
+
"realtime-transcriber"
|
|
27
27
|
],
|
|
28
|
-
"types": "./
|
|
28
|
+
"types": "./realtime-transcriber.esm.d.ts"
|
|
29
29
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface StartRealtimeTranscriberOption {
|
|
2
|
+
roomId?: number,
|
|
3
|
+
strRoomId?: string,
|
|
4
|
+
userId?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface StopRealtimeTranscriberOption {
|
|
8
|
+
roomId?: number,
|
|
9
|
+
strRoomId?: string,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export declare class RealtimeTranscriber {
|
|
14
|
+
start(option: StartRealtimeTranscriberOption): Promise<void>;
|
|
15
|
+
stop(option?: StopRealtimeTranscriberOption): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __defProp=Object.defineProperty,__defNormalProp=(r,e,a)=>e in r?__defProp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,__publicField=(r,e,a)=>__defNormalProp(r,"symbol"!=typeof e?e+"":e,a),StartValidateRule={name:"option",required:!0,properties:{sourceLanguage:{type:"string",required:!0},translationLanguages:{type:["string","array"],required:!1},userIdsToTranscribe:{type:["string","array"],required:!1},transcriberRobotId:{type:"string",required:!1}}},StopValidateRule={name:"option",required:!0,properties:{transcriberRobotId:{type:"string",required:!0}}},_RealtimeTranscriber=class r{constructor(r){this.core=r,__publicField(this,"disableRandomCall",!0),__publicField(this,"activeTranscriberMap",new Map),__publicField(this,"_log"),this._log=this.core.log.createChild({id:`${this.getAlias()}`})}getName(){return r.Name}getAlias(){return"rt-trans"}getGroup(){return"*"}getValidateRule(r){switch(r){case"start":return StartValidateRule;case"update":return{};case"stop":return StopValidateRule}}async start(r){const{RtcError:e,ErrorCode:a}=this.core.errorModule;if(!this.core.room.sendSignalMessage)throw new e({code:a.ENV_NOT_SUPPORTED});const{sourceLanguage:t,translationLanguages:o,userIdsToTranscribe:s="all",transcriberRobotId:i}=r,d=i||`transcriber_${this.core.room.sdkAppId}_${this.core.room.roomId}_robot_${this.core.room.userId}`,n={sdkappid:this.core.room.sdkAppId,roomid:String(this.core.room.roomId),roomType:this.core.room.useStringRoomId?1:0,agentParam:{cdnRobotUserid:d,lifecycleUserid:this.core.room.userId,maxIdletime:30},subscribeParams:{subUsers:[]},asrParams:{lang:t,vadSilenceTime:1e3},translationParams:{mode:1,targetLangs:[""]}};o&&o.length>0&&(n.translationParams.mode=1,n.translationParams.targetLangs=Array.isArray(o)?o:[o]),"all"===s?n.subscribeParams.subUsers=[]:Array.isArray(s)?n.subscribeParams.subUsers=s.map((r=>({userId:r,roomType:this.core.room.useStringRoomId?1:0,roomid:String(this.core.room.roomId)}))):s&&(n.subscribeParams.subUsers=[{userId:s,roomType:this.core.room.useStringRoomId?1:0,roomid:String(this.core.room.roomId)}]);try{const t=await this.core.room.sendSignalMessage({command:"start_cloud_transcription",responseCommand:String(8268),data:n,retries:0}),{code:o,data:s}=t.data;if(0!==o)throw this._log.error("start_cloud_transcription failed",{code:o,data:s}),new e({code:a.SERVER_ERROR,extraCode:o,message:s.message});const{taskId:i}=s;if(!i)throw this._log.error("taskId is required",{data:t.data}),new e({code:a.SERVER_ERROR,message:"taskId is required"});return this.activeTranscriberMap.set(i,r),i}catch(r){throw this._log.error("start_cloud_transcription failed",{error:r}),r}}async update(){}async stop({transcriberRobotId:r}){const{RtcError:e,ErrorCode:a}=this.core.errorModule;if(!this.core.room.sendSignalMessage)throw new e({code:a.ENV_NOT_SUPPORTED});try{const t=await this.core.room.sendSignalMessage({command:"stop_cloud_transcription",responseCommand:String(8270),data:{taskId:r},retries:3});if(0!==t.data.code)throw this._log.error("stop_cloud_transcription failed",{code:t.data.code,data:t.data.data}),new e({code:a.SERVER_ERROR,extraCode:t.data.code,message:t.data.message});this.activeTranscriberMap.delete(r)}catch(r){throw this._log.error("stop_cloud_transcription failed",{error:r}),r}}destroy(){this.activeTranscriberMap.clear()}};__publicField(_RealtimeTranscriber,"Name","RealtimeTranscriber");var RealtimeTranscriber=_RealtimeTranscriber,index_default=RealtimeTranscriber;export{index_default as default};export{RealtimeTranscriber};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).RealtimeTranscriber=r()}(this,(function(){"use strict";function t(t,r,e,n,o,a,i){try{var s=t[a](i),c=s.value}catch(t){return void e(t)}s.done?r(c):Promise.resolve(c).then(n,o)}function r(r){return function(){var e=this,n=arguments;return new Promise((function(o,a){var i=r.apply(e,n);function s(r){t(i,o,a,s,c,"next",r)}function c(r){t(i,o,a,s,c,"throw",r)}s(void 0)}))}}function e(t,r,e){return r&&function(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),s=new O(n||[]);return a(i,"_invoke",{value:S(t,e,s)}),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var d="suspendedStart",p="suspendedYield",y="executing",m="completed",g={};function v(){}function b(){}function w(){}var _={};l(_,s,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==e&&o.call(x,s)&&(_=x);var L=w.prototype=v.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function R(t,r){function e(n,a,i,s){var c=h(t[n],t,a);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,i,s)}),(function(t){e("throw",t,i,s)})):r.resolve(l).then((function(t){u.value=t,i(u)}),(function(t){return e("throw",t,i,s)}))}s(c.arg)}var n;a(this,"_invoke",{value:function(t,o){function a(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(a,a):a()}})}function S(r,e,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var c=T(s,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(r,e,n);if("normal"===u.type){if(o=n.done?m:p,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=m,n.method="throw",n.arg=u.arg)}}}function T(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,T(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,r.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,g;var i=a.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,g):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function I(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function P(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function j(r){if(r||""===r){var e=r[s];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,a=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return b.prototype=w,a(L,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===b||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(L),t},r.awrap=function(t){return{__await:t}},k(R.prototype),l(R.prototype,c,(function(){return this})),r.AsyncIterator=R,r.async=function(t,e,n,o,a){void 0===a&&(a=Promise);var i=new R(f(t,e,n,o),a);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},k(L),l(L,u,"Generator"),l(L,s,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=j,O.prototype={constructor:O,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return s.type="throw",s.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),P(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;P(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:j(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function o(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof r?r:r+""}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}var i=Object.defineProperty,s=function(t,r,e){return function(t,r,e){return r in t?i(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e}(t,"symbol"!==a(r)?r+"":r,e)},c={name:"option",required:!0,properties:{sourceLanguage:{type:"string",required:!0},translationLanguages:{type:["string","array"],required:!1},userIdsToTranscribe:{type:["string","array"],required:!1},transcriberRobotId:{type:"string",required:!1}}},u={name:"option",required:!0,properties:{transcriberRobotId:{type:"string",required:!0}}},l=function(){function t(r){!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=r,s(this,"disableRandomCall",!0),s(this,"activeTranscriberMap",new Map),s(this,"_log"),this._log=this.core.log.createChild({id:"".concat(this.getAlias())})}return e(t,[{key:"getName",value:function(){return t.Name}},{key:"getAlias",value:function(){return"rt-trans"}},{key:"getGroup",value:function(){return"*"}},{key:"getValidateRule",value:function(t){switch(t){case"start":return c;case"update":return{};case"stop":return u}}},{key:"start",value:(i=r(n().mark((function t(r){var e,o,a,i,s,c,u,l,f,h,d,p,y,m,g,v=this;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.core.errorModule,o=e.RtcError,a=e.ErrorCode,this.core.room.sendSignalMessage){t.next=3;break}throw new o({code:a.ENV_NOT_SUPPORTED});case 3:return i=r.sourceLanguage,s=r.translationLanguages,c=r.userIdsToTranscribe,u=void 0===c?"all":c,l=r.transcriberRobotId,f=l||"transcriber_".concat(this.core.room.sdkAppId,"_").concat(this.core.room.roomId,"_robot_").concat(this.core.room.userId),h={sdkappid:this.core.room.sdkAppId,roomid:String(this.core.room.roomId),roomType:this.core.room.useStringRoomId?1:0,agentParam:{cdnRobotUserid:f,lifecycleUserid:this.core.room.userId,maxIdletime:30},subscribeParams:{subUsers:[]},asrParams:{lang:i,vadSilenceTime:1e3},translationParams:{mode:1,targetLangs:[""]}},s&&s.length>0&&(h.translationParams.mode=1,h.translationParams.targetLangs=Array.isArray(s)?s:[s]),"all"===u?h.subscribeParams.subUsers=[]:Array.isArray(u)?h.subscribeParams.subUsers=u.map((function(t){return{userId:t,roomType:v.core.room.useStringRoomId?1:0,roomid:String(v.core.room.roomId)}})):u&&(h.subscribeParams.subUsers=[{userId:u,roomType:this.core.room.useStringRoomId?1:0,roomid:String(this.core.room.roomId)}]),t.prev=8,t.next=11,this.core.room.sendSignalMessage({command:"start_cloud_transcription",responseCommand:String(8268),data:h,retries:0});case 11:if(d=t.sent,p=d.data,y=p.code,m=p.data,0===y){t.next=16;break}throw this._log.error("start_cloud_transcription failed",{code:y,data:m}),new o({code:a.SERVER_ERROR,extraCode:y,message:m.message});case 16:if(g=m.taskId){t.next=20;break}throw this._log.error("taskId is required",{data:d.data}),new o({code:a.SERVER_ERROR,message:"taskId is required"});case 20:return this.activeTranscriberMap.set(g,r),t.abrupt("return",g);case 24:throw t.prev=24,t.t0=t.catch(8),this._log.error("start_cloud_transcription failed",{error:t.t0}),t.t0;case 28:case"end":return t.stop()}}),t,this,[[8,24]])}))),function(t){return i.apply(this,arguments)})},{key:"update",value:(a=r(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(){return a.apply(this,arguments)})},{key:"stop",value:(o=r(n().mark((function t(r){var e,o,a,i,s;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=r.transcriberRobotId,o=this.core.errorModule,a=o.RtcError,i=o.ErrorCode,this.core.room.sendSignalMessage){t.next=4;break}throw new a({code:i.ENV_NOT_SUPPORTED});case 4:return t.prev=4,t.next=7,this.core.room.sendSignalMessage({command:"stop_cloud_transcription",responseCommand:String(8270),data:{taskId:e},retries:3});case 7:if(0===(s=t.sent).data.code){t.next=11;break}throw this._log.error("stop_cloud_transcription failed",{code:s.data.code,data:s.data.data}),new a({code:i.SERVER_ERROR,extraCode:s.data.code,message:s.data.message});case 11:this.activeTranscriberMap.delete(e),t.next=18;break;case 14:throw t.prev=14,t.t0=t.catch(4),this._log.error("stop_cloud_transcription failed",{error:t.t0}),t.t0;case 18:case"end":return t.stop()}}),t,this,[[4,14]])}))),function(t){return o.apply(this,arguments)})},{key:"destroy",value:function(){this.activeTranscriberMap.clear()}}]);var o,a,i}();return s(l,"Name","RealtimeTranscriber"),l}));
|