@tencentcloud/trtc-component-wx 0.0.11 → 0.0.12

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.
@@ -124,7 +124,7 @@ Component({
124
124
  this.bindTRTCCloudEvent();
125
125
  },
126
126
  detached: function detached() {
127
- trtcCloud.logger.info('trtc-player attached', this.data.streamId);
127
+ trtcCloud.logger.info('trtc-player detached', this.data.streamId);
128
128
  this.unbindTRTCCloudEvent();
129
129
  }
130
130
  },
@@ -140,9 +140,11 @@ Component({
140
140
  _this.data.streamId = id;
141
141
  _this.data.TRTCStreamId = _this.getTRTCStreamId(id);
142
142
  _this.setData({ streamId: _this.data.streamId }, function () {
143
+ trtcCloud.logger.info('trtc-player setTRTCStreamId success', id);
143
144
  resolve();
144
145
  });
145
146
  } catch (err) {
147
+ trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err);
146
148
  reject(err);
147
149
  }
148
150
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@tencentcloud/trtc-cloud-wx\"","webpack:///./src/trtc-player.js"],"names":["trtcCloud","TRTCCloud","getTRTCShareInstance","trtc","InterfaceEventEmitter","Component","properties","streamId","String","data","player","TRTCStreamId","lifetimes","attached","logger","info","getTRTCStreamId","bindTRTCCloudEvent","detached","unbindTRTCCloudEvent","methods","setTRTCStreamId","id","Promise","resolve","reject","setData","err","playerAttributesChange","event","view","playerAttributes","callback","tempArray","split","userId","slice","join","streamType","Number","length","on","off","_playerStateChange","playerEventHandler","_playerFullscreenChange","playerFullscreenChange","_playerNetStatus","playerNetStatus","_playerAudioVolumeNotify","currentTarget","dataset","streamid","streamID","playerAudioVolumeNotify"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;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,CAAwBf,KAAxB;AACD,KArCM;AAsCPgB,2BAtCO,mCAsCiBhB,KAtCjB,EAsCwB;AAC7B1B,WAAK2C,sBAAL,CAA4BjB,KAA5B;AACD,KAxCM;AAyCPkB,oBAzCO,4BAyCUlB,KAzCV,EAyCiB;AACtB1B,WAAK6C,eAAL,CAAqBnB,KAArB;AACD,KA3CM;AA4CPoB,4BA5CO,oCA4CkBpB,KA5ClB,EA4CyB;AAC9BA,YAAMqB,aAAN,CAAoBC,OAApB,CAA4BC,QAA5B,GAAuC,KAAK3C,IAAL,CAAUC,MAAV,CAAiB2C,QAAxD;AACAlD,WAAKmD,uBAAL,CAA6BzB,KAA7B;AACD;AA/CM;AApBD,CAAV,E","file":"trtc-player.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = require(\"@tencentcloud/trtc-cloud-wx\");","import TRTCCloud, {translateTRTCStreamId} from '@tencentcloud/trtc-cloud-wx'\n\nconst trtcCloud = TRTCCloud.getTRTCShareInstance()\nconst trtc = trtcCloud.trtc\nconst InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter\n\nComponent({\n properties: {\n streamId: String\n },\n data: {\n player: {},\n TRTCStreamId: ''\n },\n lifetimes: {\n attached() {\n trtcCloud.logger.info('trtc-player attached', this.data.streamId)\n this.data.TRTCStreamId = this.getTRTCStreamId(this.data.streamId)\n this.bindTRTCCloudEvent()\n },\n detached() {\n trtcCloud.logger.info('trtc-player attached', this.data.streamId)\n this.unbindTRTCCloudEvent()\n }\n },\n\n methods: {\n // todo room uniapp 特供,因为 uniapp 打包导致组件传惨变量名更替 trtc-player 组建内部无法识别\n setTRTCStreamId(id) {\n trtcCloud.logger.info('trtc-player setTRTCStreamId', id)\n return new Promise((resolve, reject) => {\n try {\n this.data.streamId = id\n this.data.TRTCStreamId = this.getTRTCStreamId(id)\n this.setData({streamId: this.data.streamId}, () => {\n resolve()\n })\n } catch (err) {\n reject(err)\n }\n })\n },\n playerAttributesChange(event) {\n const {view, playerAttributes, callback} = event\n if (view === this.data.streamId) {\n this.setData({player: playerAttributes}, callback)\n }\n },\n getTRTCStreamId(streamId) {\n const tempArray = streamId.split('_')\n const userId = tempArray.slice(0, -1).join('_')\n const streamType = Number(tempArray[tempArray.length - 1])\n return translateTRTCStreamId(userId, streamType)\n },\n bindTRTCCloudEvent() {\n InterfaceEventEmitter.on('playerAttributesChange', this.playerAttributesChange, this)\n },\n unbindTRTCCloudEvent() {\n InterfaceEventEmitter.off('playerAttributesChange', this.playerAttributesChange)\n },\n // 请保持跟 wxml 中绑定的事件名称一致\n _playerStateChange(event) {\n trtc.playerEventHandler(event)\n },\n _playerFullscreenChange(event) {\n trtc.playerFullscreenChange(event)\n },\n _playerNetStatus(event) {\n trtc.playerNetStatus(event)\n },\n _playerAudioVolumeNotify(event) {\n event.currentTarget.dataset.streamid = this.data.player.streamID\n trtc.playerAudioVolumeNotify(event)\n },\n }\n})\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@tencentcloud/trtc-cloud-wx\"","webpack:///./src/trtc-player.js"],"names":["trtcCloud","TRTCCloud","getTRTCShareInstance","trtc","InterfaceEventEmitter","Component","properties","streamId","String","data","player","TRTCStreamId","lifetimes","attached","logger","info","getTRTCStreamId","bindTRTCCloudEvent","detached","unbindTRTCCloudEvent","methods","setTRTCStreamId","id","Promise","resolve","reject","setData","err","playerAttributesChange","event","view","playerAttributes","callback","tempArray","split","userId","slice","join","streamType","Number","length","on","off","_playerStateChange","playerEventHandler","_playerFullscreenChange","playerFullscreenChange","_playerNetStatus","playerNetStatus","_playerAudioVolumeNotify","currentTarget","dataset","streamid","streamID","playerAudioVolumeNotify"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,wD;;;;;;;;;;ACAA;;;;;;AAEA,IAAMA,YAAYC,sBAAUC,oBAAV,EAAlB;AACA,IAAMC,OAAOH,UAAUG,IAAvB;AACA,IAAMC,wBAAwBJ,UAAUI,qBAAxC;;AAEAC,UAAU;AACRC,cAAY;AACVC,cAAUC;AADA,GADJ;AAIRC,QAAM;AACJC,YAAQ,EADJ;AAEJC,kBAAc;AAFV,GAJE;AAQRC,aAAW;AACTC,YADS,sBACE;AACTb,gBAAUc,MAAV,CAAiBC,IAAjB,CAAsB,sBAAtB,EAA8C,KAAKN,IAAL,CAAUF,QAAxD;AACA,WAAKE,IAAL,CAAUE,YAAV,GAAyB,KAAKK,eAAL,CAAqB,KAAKP,IAAL,CAAUF,QAA/B,CAAzB;AACA,WAAKU,kBAAL;AACD,KALQ;AAMTC,YANS,sBAME;AACTlB,gBAAUc,MAAV,CAAiBC,IAAjB,CAAs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EAAuBC,IAAvB,CAA4B,GAA5B,CAAf;AACA,UAAMC,aAAaC,OAAON,UAAUA,UAAUO,MAAV,GAAmB,CAA7B,CAAP,CAAnB;AACA,aAAO,wCAAsBL,MAAtB,EAA8BG,UAA9B,CAAP;AACD,KA7BM;AA8BPrB,sBA9BO,gCA8Bc;AACnBb,4BAAsBqC,EAAtB,CAAyB,wBAAzB,EAAmD,KAAKb,sBAAxD,EAAgF,IAAhF;AACD,KAhCM;AAiCPT,wBAjCO,kCAiCgB;AACrBf,4BAAsBsC,GAAtB,CAA0B,wBAA1B,EAAoD,KAAKd,sBAAzD;AACD,KAnCM;;AAoCP;AACAe,sBArCO,8BAqCYd,KArCZ,EAqCmB;AACxB1B,WAAKyC,kBAAL,CAAwBf,KAAxB;AACD,KAvCM;AAwCPgB,2BAxCO,mCAwCiBhB,KAxCjB,EAwCwB;AAC7B1B,WAAK2C,sBAAL,CAA4BjB,KAA5B;AACD,KA1CM;AA2CPkB,oBA3CO,4BA2CUlB,KA3CV,EA2CiB;AACtB1B,WAAK6C,eAAL,CAAqBnB,KAArB;AACD,KA7CM;AA8CPoB,4BA9CO,oCA8CkBpB,KA9ClB,EA8CyB;AAC9BA,YAAMqB,aAAN,CAAoBC,OAApB,CAA4BC,QAA5B,GAAuC,KAAK3C,IAAL,CAAUC,MAAV,CAAiB2C,QAAxD;AACAlD,WAAKmD,uBAAL,CAA6BzB,KAA7B;AACD;AAjDM;AApBD,CAAV,E","file":"trtc-player.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = require(\"@tencentcloud/trtc-cloud-wx\");","import TRTCCloud, {translateTRTCStreamId} from '@tencentcloud/trtc-cloud-wx'\n\nconst trtcCloud = TRTCCloud.getTRTCShareInstance()\nconst trtc = trtcCloud.trtc\nconst InterfaceEventEmitter = trtcCloud.InterfaceEventEmitter\n\nComponent({\n properties: {\n streamId: String\n },\n data: {\n player: {},\n TRTCStreamId: ''\n },\n lifetimes: {\n attached() {\n trtcCloud.logger.info('trtc-player attached', this.data.streamId)\n this.data.TRTCStreamId = this.getTRTCStreamId(this.data.streamId)\n this.bindTRTCCloudEvent()\n },\n detached() {\n trtcCloud.logger.info('trtc-player detached', this.data.streamId)\n this.unbindTRTCCloudEvent()\n }\n },\n\n methods: {\n // todo room uniapp 特供,因为 uniapp 打包导致组件传惨变量名更替 trtc-player 组建内部无法识别\n setTRTCStreamId(id) {\n trtcCloud.logger.info('trtc-player setTRTCStreamId', id)\n return new Promise((resolve, reject) => {\n try {\n this.data.streamId = id\n this.data.TRTCStreamId = this.getTRTCStreamId(id)\n this.setData({streamId: this.data.streamId}, () => {\n trtcCloud.logger.info('trtc-player setTRTCStreamId success', id)\n resolve()\n })\n } catch (err) {\n trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err)\n reject(err)\n }\n })\n },\n playerAttributesChange(event) {\n const {view, playerAttributes, callback} = event\n if (view === this.data.streamId) {\n this.setData({player: playerAttributes}, callback)\n }\n },\n getTRTCStreamId(streamId) {\n const tempArray = streamId.split('_')\n const userId = tempArray.slice(0, -1).join('_')\n const streamType = Number(tempArray[tempArray.length - 1])\n return translateTRTCStreamId(userId, streamType)\n },\n bindTRTCCloudEvent() {\n InterfaceEventEmitter.on('playerAttributesChange', this.playerAttributesChange, this)\n },\n unbindTRTCCloudEvent() {\n InterfaceEventEmitter.off('playerAttributesChange', this.playerAttributesChange)\n },\n // 请保持跟 wxml 中绑定的事件名称一致\n _playerStateChange(event) {\n trtc.playerEventHandler(event)\n },\n _playerFullscreenChange(event) {\n trtc.playerFullscreenChange(event)\n },\n _playerNetStatus(event) {\n trtc.playerNetStatus(event)\n },\n _playerAudioVolumeNotify(event) {\n event.currentTarget.dataset.streamid = this.data.player.streamID\n trtc.playerAudioVolumeNotify(event)\n },\n }\n})\n"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencentcloud/trtc-component-wx",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -67,7 +67,7 @@
67
67
  "webpack-node-externals": "^1.7.2"
68
68
  },
69
69
  "dependencies": {
70
- "@tencentcloud/trtc-cloud-wx": "^0.0.9",
70
+ "@tencentcloud/trtc-cloud-wx": "^0.0.10",
71
71
  "trtc-wx-sdk": "^1.1.5"
72
72
  }
73
73
  }
@@ -19,7 +19,7 @@ Component({
19
19
  this.bindTRTCCloudEvent()
20
20
  },
21
21
  detached() {
22
- trtcCloud.logger.info('trtc-player attached', this.data.streamId)
22
+ trtcCloud.logger.info('trtc-player detached', this.data.streamId)
23
23
  this.unbindTRTCCloudEvent()
24
24
  }
25
25
  },
@@ -33,9 +33,11 @@ Component({
33
33
  this.data.streamId = id
34
34
  this.data.TRTCStreamId = this.getTRTCStreamId(id)
35
35
  this.setData({streamId: this.data.streamId}, () => {
36
+ trtcCloud.logger.info('trtc-player setTRTCStreamId success', id)
36
37
  resolve()
37
38
  })
38
39
  } catch (err) {
40
+ trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err)
39
41
  reject(err)
40
42
  }
41
43
  })