@tencentcloud/trtc-component-wx 0.0.21 → 0.0.23-beta.1
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/copy_to_roomkit.js +19 -0
- package/miniprogram_dist/trtc-player.js +2 -0
- package/miniprogram_dist/trtc-player.js.map +1 -1
- package/miniprogram_dist/trtc-player.wxml +1 -1
- package/miniprogram_dist/trtc-pusher.wxml +1 -1
- package/package.json +3 -3
- package/src/trtc-player.js +2 -0
- package/src/trtc-player.wxml +1 -1
- package/src/trtc-pusher.wxml +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
const sourceDir = '/Users/connor/Desktop/work/TRTCCloud-wx/trtc-component-wx/miniprogram_dist'
|
|
5
|
+
const targetDir = '/Users/connor/Desktop/TUIRoomEngine/samples/tui-room-uniapp/dist/build/mp-weixin/node_modules/@tencentcloud/trtc-component-wx/miniprogram_dist'
|
|
6
|
+
|
|
7
|
+
fs.readdir(sourceDir, (err, files) => {
|
|
8
|
+
if (err) throw err
|
|
9
|
+
|
|
10
|
+
files.forEach((file) => {
|
|
11
|
+
const sourceFile = path.join(sourceDir, file)
|
|
12
|
+
const targetFile = path.join(targetDir, file)
|
|
13
|
+
|
|
14
|
+
fs.copyFile(sourceFile, targetFile, (err) => {
|
|
15
|
+
if (err) throw err
|
|
16
|
+
console.log(`${sourceFile} was copied to ${targetFile}`)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -125,6 +125,7 @@ Component({
|
|
|
125
125
|
},
|
|
126
126
|
detached: function detached() {
|
|
127
127
|
trtcCloud.logger.info('trtc-player detached', this.data.streamId);
|
|
128
|
+
InterfaceEventEmitter.emit('playerDomReady', { isReady: false, streamId: this.data.streamId });
|
|
128
129
|
this.unbindTRTCCloudEvent();
|
|
129
130
|
}
|
|
130
131
|
},
|
|
@@ -142,6 +143,7 @@ Component({
|
|
|
142
143
|
_this.setData({ streamId: _this.data.streamId }, function () {
|
|
143
144
|
trtcCloud.logger.info('trtc-player setTRTCStreamId success', id);
|
|
144
145
|
resolve();
|
|
146
|
+
InterfaceEventEmitter.emit('playerDomReady', { isReady: true, view: id });
|
|
145
147
|
});
|
|
146
148
|
} catch (err) {
|
|
147
149
|
trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err);
|
|
@@ -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","
|
|
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","emit","isReady","unbindTRTCCloudEvent","methods","setTRTCStreamId","id","Promise","resolve","reject","setData","view","err","playerAttributesChange","event","playerAttributes","callback","tempArray","split","userId","slice","join","streamType","Number","length","on","off","_playerStateChange","playerEventHandler","_playerFullscreenChange","playerFullscreenChange","_playerNetStatus","playerNetStatus","_playerAudioVolumeNotify","currentTarget","dataset","streamid","streamID","playerAudioVolumeNotify","warn"],"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;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B,CAAP,CAAnB;AACA,aAAO,wCAAsBL,MAAtB,EAA8BG,UAA9B,CAAP;AACD,KA9BM;AA+BPvB,sBA/BO,gCA+Bc;AACnBb,4BAAsBuC,EAAtB,CAAyB,wBAAzB,EAAmD,KAAKZ,sBAAxD,EAAgF,IAAhF;AACD,KAjCM;AAkCPV,wBAlCO,kCAkCgB;AACrBjB,4BAAsBwC,GAAtB,CAA0B,wBAA1B,EAAoD,KAAKb,sBAAzD;AACD,KApCM;;AAqCP;AACAc,sBAtCO,8BAsCYb,KAtCZ,EAsCmB;AACxB7B,WAAK2C,kBAAL,CAAwBd,KAAxB;AACD,KAxCM;AAyCPe,2BAzCO,mCAyCiBf,KAzCjB,EAyCwB;AAC7B7B,WAAK6C,sBAAL,CAA4BhB,KAA5B;AACD,KA3CM;AA4CPiB,oBA5CO,4BA4CUjB,KA5CV,EA4CiB;AACtB7B,WAAK+C,eAAL,CAAqBlB,KAArB;AACD,KA9CM;AA+CPmB,4BA/CO,oCA+CkBnB,KA/ClB,EA+CyB;AAC9B,UAAI;AACFA,cAAMoB,aAAN,CAAoBC,OAApB,CAA4BC,QAA5B,GAAuC,KAAK7C,IAAL,CAAUC,MAAV,CAAiB6C,QAAxD;AACApD,aAAKqD,uBAAL,CAA6BxB,KAA7B;AACD,OAHD,CAGE,OAAOF,GAAP,EAAY;AACZ9B,kBAAUc,MAAV,CAAiB2C,IAAjB,CAAsB3B,GAAtB;AACD;AACF;AAtDM;AArBD,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 InterfaceEventEmitter.emit('playerDomReady', {isReady: false, streamId: 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 InterfaceEventEmitter.emit('playerDomReady', {isReady: true, view: id})\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 try {\n event.currentTarget.dataset.streamid = this.data.player.streamID\n trtc.playerAudioVolumeNotify(event)\n } catch (err) {\n trtcCloud.logger.warn(err)\n }\n },\n }\n})\n"],"sourceRoot":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<view class="trtc-player-container">
|
|
2
|
-
<live-player wx:if="{{
|
|
2
|
+
<live-player wx:if="{{streamId}}" class="trtc-player" id="{{player.streamID}}" data-userid="{{player.userID}}"
|
|
3
3
|
data-streamid="{{player.streamID}}" data-streamtype="{{player.streamType}}" src="{{player.src}}" mode="RTC"
|
|
4
4
|
autoplay="{{player.autoplay}}" mute-audio="{{player.muteAudio}}" mute-video="{{player.muteVideo}}"
|
|
5
5
|
orientation="{{player.orientation}}" object-fit="{{player.objectFit}}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<view class="trtc-pusher-container">
|
|
2
2
|
<live-pusher class="trtc-pusher" url="{{pusher.url}}" mode="{{pusher.mode}}" autopush="{{pusher.autopush}}"
|
|
3
|
-
enable-camera="{{pusher.enableCamera}}" enable-mic="{{pusher.enableMic}}" muted="{{
|
|
3
|
+
enable-camera="{{pusher.enableCamera}}" enable-mic="{{pusher.enableMic}}" muted="{{pusher.muted}}"
|
|
4
4
|
enable-agc="{{pusher.enableAgc}}" enable-ans="{{pusher.enableAns}}"
|
|
5
5
|
enable-ear-monitor="{{pusher.enableEarMonitor}}" auto-focus="{{pusher.enableAutoFocus}}"
|
|
6
6
|
zoom="{{pusher.enableZoom}}" min-bitrate="{{pusher.minBitrate}}" max-bitrate="{{pusher.maxBitrate}}"
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencentcloud/trtc-component-wx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "miniprogram_dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "gulp dev --develop",
|
|
8
8
|
"watch": "gulp watch --develop --watch",
|
|
9
|
-
"build": "gulp",
|
|
9
|
+
"build": "gulp && node ./copy_to_roomkit.js",
|
|
10
10
|
"dist": "npm run build",
|
|
11
11
|
"clean-dev": "gulp clean --develop",
|
|
12
12
|
"clean": "gulp clean",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"webpack-node-externals": "^1.7.2"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@tencentcloud/trtc-cloud-wx": "
|
|
70
|
+
"@tencentcloud/trtc-cloud-wx": "0.0.20-beta.1",
|
|
71
71
|
"trtc-wx-sdk": "^1.1.5"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/trtc-player.js
CHANGED
|
@@ -20,6 +20,7 @@ Component({
|
|
|
20
20
|
},
|
|
21
21
|
detached() {
|
|
22
22
|
trtcCloud.logger.info('trtc-player detached', this.data.streamId)
|
|
23
|
+
InterfaceEventEmitter.emit('playerDomReady', {isReady: false, streamId: this.data.streamId})
|
|
23
24
|
this.unbindTRTCCloudEvent()
|
|
24
25
|
}
|
|
25
26
|
},
|
|
@@ -35,6 +36,7 @@ Component({
|
|
|
35
36
|
this.setData({streamId: this.data.streamId}, () => {
|
|
36
37
|
trtcCloud.logger.info('trtc-player setTRTCStreamId success', id)
|
|
37
38
|
resolve()
|
|
39
|
+
InterfaceEventEmitter.emit('playerDomReady', {isReady: true, view: id})
|
|
38
40
|
})
|
|
39
41
|
} catch (err) {
|
|
40
42
|
trtcCloud.logger.info('trtc-player setTRTCStreamId fail', id, err)
|
package/src/trtc-player.wxml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<view class="trtc-player-container">
|
|
2
|
-
<live-player wx:if="{{
|
|
2
|
+
<live-player wx:if="{{streamId}}" class="trtc-player" id="{{player.streamID}}" data-userid="{{player.userID}}"
|
|
3
3
|
data-streamid="{{player.streamID}}" data-streamtype="{{player.streamType}}" src="{{player.src}}" mode="RTC"
|
|
4
4
|
autoplay="{{player.autoplay}}" mute-audio="{{player.muteAudio}}" mute-video="{{player.muteVideo}}"
|
|
5
5
|
orientation="{{player.orientation}}" object-fit="{{player.objectFit}}"
|
package/src/trtc-pusher.wxml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<view class="trtc-pusher-container">
|
|
2
2
|
<live-pusher class="trtc-pusher" url="{{pusher.url}}" mode="{{pusher.mode}}" autopush="{{pusher.autopush}}"
|
|
3
|
-
enable-camera="{{pusher.enableCamera}}" enable-mic="{{pusher.enableMic}}" muted="{{
|
|
3
|
+
enable-camera="{{pusher.enableCamera}}" enable-mic="{{pusher.enableMic}}" muted="{{pusher.muted}}"
|
|
4
4
|
enable-agc="{{pusher.enableAgc}}" enable-ans="{{pusher.enableAns}}"
|
|
5
5
|
enable-ear-monitor="{{pusher.enableEarMonitor}}" auto-focus="{{pusher.enableAutoFocus}}"
|
|
6
6
|
zoom="{{pusher.enableZoom}}" min-bitrate="{{pusher.minBitrate}}" max-bitrate="{{pusher.maxBitrate}}"
|