giraffetrtcmp
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,1 @@ | ||
import TRTC from"./static/trtc-wx";import evidenceSvg from"./static/svg/evidence.svg";import checkSvg from"./static/svg/check.svg";import micSvg from"./static/svg/mic.svg";import micOffSvg from"./static/svg/micoff.svg";import videoSvg from"./static/svg/video.svg";import videoOffSvg from"./static/svg/videooff.svg";Component({properties:{sdkAppID:String,roomID:String,userID:String,userSig:String,footerVisible:Boolean},options:{multipleSlots:!0},observers:{"sdkAppID,roomID,userID,userSig":function(e,t,s,i){console.log("[GiraffeRtc] : 外部参数初始化:"),console.log(e,t,s,i),e&&t&&s&&i&&(console.log("[GiraffeRtc] : 外部参数校验成功:"),console.log(this.TRTC),this.init(e,s,i),this.bindTRTCRoomEvent(),this.enterRoom(t),this.triggerEvent("onRtcLoad",this.data._rtcConfig))}},lifetimes:{attached:function(){console.log("[GiraffeRtc] : 生命周期attached : "),wx.setKeepScreenOn({keepScreenOn:!0}),this.TRTC=new TRTC(this)},detached:function(){}},data:{_rtcConfig:{},playerList:[],footerVisible:!0,bottomBoxVisible:!0,evidenceSvg:evidenceSvg,checkSvg:checkSvg,micSvg:micSvg,micOffSvg:micOffSvg,videoSvg:videoSvg,videoOffSvg:videoOffSvg},methods:{init(e,t,s){var i=this.TRTC.createPusher({beautyLevel:9});this.setData({_rtcConfig:{userID:t,sdkAppID:e,userSig:s},pusher:i.pusherAttributes,localAudio:!1,localVideo:!0}),console.log("[GiraffeRtc] : [Funcion Init] : Data"),console.log(this.data._rtcConfig)},enterRoom(e){e=Object.assign(this.data._rtcConfig,{roomID:e});this.setData({pusher:this.TRTC.enterRoom(e)},()=>{this.TRTC.getPusherInstance().start(),console.log(this.data.pusher)})},bindTRTCRoomEvent(){var e=this.TRTC.EVENT;this.TRTC.on(e.LOCAL_JOIN,e=>{console.log("* room LOCAL_JOIN",e),this.data.localVideo&&this.setPusherAttributesHandler({enableCamera:!0}),this.data.localAudio&&this.setPusherAttributesHandler({enableMic:!0})}),this.TRTC.on(e.LOCAL_LEAVE,e=>{console.log("* room LOCAL_LEAVE",e)}),this.TRTC.on(e.ERROR,e=>{console.log("* room ERROR",e)}),this.TRTC.on(e.REMOTE_USER_JOIN,e=>{console.log("* room REMOTE_USER_JOIN",e);var e=e.data["userID"],e=this.data.membernames[e];wx.showToast({title:`${e} 进入了房间`,icon:"none",duration:2e3})}),this.TRTC.on(e.REMOTE_USER_LEAVE,e=>{console.log("* room REMOTE_USER_LEAVE",e);var{userID:t,playerList:e}=e.data;this.setData({playerList:e});t=this.data.membernames[t];wx.showToast({title:`${t} 离开了房间`,icon:"none",duration:2e3})}),this.TRTC.on(e.REMOTE_VIDEO_ADD,e=>{console.log("* room REMOTE_VIDEO_ADD",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteVideo:!1})}),this.TRTC.on(e.REMOTE_VIDEO_REMOVE,e=>{console.log("* room REMOTE_VIDEO_REMOVE",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteVideo:!0})}),this.TRTC.on(e.REMOTE_AUDIO_ADD,e=>{console.log("* room REMOTE_AUDIO_ADD",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteAudio:!1})}),this.TRTC.on(e.REMOTE_AUDIO_REMOVE,e=>{console.log("* room REMOTE_AUDIO_REMOVE",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteAudio:!0})}),this.TRTC.on(e.REMOTE_AUDIO_VOLUME_UPDATE,e=>{console.log("* room REMOTE_AUDIO_VOLUME_UPDATE",e);var e=e.data["playerList"];this.setData({playerList:e})}),this.TRTC.on(e.LOCAL_AUDIO_VOLUME_UPDATE,e=>{var e=e.data["pusher"];this.setData({pusher:e})})},exitRoom(){this.TRTC.exitRoom(),this.triggerEvent("exitRoom")},setPusherAttributesHandler(e){this.setData({pusher:this.TRTC.setPusherAttributes(e)}),console.log(this.data.pusher)},setPlayerAttributesHandler(e,t){this.setData({playerList:this.TRTC.setPlayerAttributes(e.streamID,t)})},getAudioStatus(){return this.data.pusher.enableMic},getVideoStatus(){return this.data.pusher.enableCamera},_fullScreen(e){const t=e.currentTarget.dataset.value;e=[...this.data.playerList].map(e=>(e.id===t.id?(e.isFull?(this.setData({bottomBoxVisible:!0}),this.triggerEvent("fullScreenChange",!0)):(this.setData({bottomBoxVisible:!1}),this.triggerEvent("fullScreenChange",!1)),e.isFull=!e.isFull):e.isFull=!1,e));this.setData({playerList:e})},_mutePlayerAudio(e){e=e.currentTarget.dataset.value;e.hasAudio&&e.muteAudio?this.setPlayerAttributesHandler(e,{muteAudio:!1}):e.hasAudio&&!e.muteAudio&&this.setPlayerAttributesHandler(e,{muteAudio:!0})},_mutePlayerVideo(e){e=e.currentTarget.dataset.value;e.hasVideo&&e.muteVideo?this.setPlayerAttributesHandler(e,{muteVideo:!1}):e.hasVideo&&!e.muteVideo&&this.setPlayerAttributesHandler(e,{muteVideo:!0})},_hangUp(){this.exitRoom()},_setPusherBeautyHandle(){var e=0===this.data.pusher.beautyLevel?9:0;this.setPusherAttributesHandler({beautyLevel:e})},_pusherAudioHandler(){this.data.pusher.enableMic?(this.setPusherAttributesHandler({enableMic:!1}),this.triggerEvent("localAudioChange",!1)):(this.setPusherAttributesHandler({enableMic:!0}),this.triggerEvent("localAudioChange",!0))},_pusherVideoHandler(){this.data.pusher.enableCamera?(this.setPusherAttributesHandler({enableCamera:!1}),this.triggerEvent("localVideoChange",!1)):(this.setPusherAttributesHandler({enableCamera:!0}),this.triggerEvent("localVideoChange",!0))},_switchMemberListPanel(){this.setData({show_memberList:!0})},_handleClose(){this.setData({show_memberList:!1,show_caseinfo:!1})},_pusherStateChangeHandler(e){this.TRTC.pusherEventHandler(e)},_pusherNetStatusHandler(e){this.TRTC.pusherNetStatusHandler(e)},_pusherErrorHandler(e){console.log("推流失败"),this.TRTC.pusherErrorHandler(e)},_pusherBGMStartHandler(e){this.TRTC.pusherBGMStartHandler(e)},_pusherBGMProgressHandler(e){this.TRTC.pusherBGMProgressHandler(e)},_pusherBGMCompleteHandler(e){this.TRTC.pusherBGMCompleteHandler(e)},_pusherAudioVolumeNotify(e){this.TRTC.pusherAudioVolumeNotify(e)},_playerStateChange(e){this.TRTC.playerEventHandler(e)},_playerFullscreenChange(e){this.TRTC.playerFullscreenChange(e)},_playerNetStatus(e){this.TRTC.playerNetStatus(e)},_playerAudioVolumeNotify(e){this.TRTC.playerAudioVolumeNotify(e)}},behaviors:["wx://component-export"],export(){return{exitRoom:this.exitRoom.bind(this),getAudioStatus:this.getAudioStatus.bind(this),getVideoStatus:this.getVideoStatus.bind(this),setLocalAudio:this._pusherAudioHandler.bind(this),setLocalVideo:this._pusherVideoHandler.bind(this)}}}); | ||
import TRTC from"./static/trtc-wx";import evidenceSvg from"./static/svg/evidence.svg";import checkSvg from"./static/svg/check.svg";import micSvg from"./static/svg/mic.svg";import micOffSvg from"./static/svg/micoff.svg";import videoSvg from"./static/svg/video.svg";import videoOffSvg from"./static/svg/videooff.svg";Component({properties:{sdkAppID:String,roomID:String,userID:String,userSig:String,footerVisible:Boolean,names:Object},options:{multipleSlots:!0},observers:{"sdkAppID,roomID,userID,userSig":function(e,t,s,i){console.log("[GiraffeRtc] : 外部参数初始化:"),console.log(e,t,s,i),e&&t&&s&&i&&(console.log("[GiraffeRtc] : 外部参数校验成功:"),console.log(this.TRTC),this.init(e,s,i),this.bindTRTCRoomEvent(),this.enterRoom(t),this.triggerEvent("onRtcLoad",this.data._rtcConfig))}},lifetimes:{attached:function(){console.log("[GiraffeRtc] : 生命周期attached : "),wx.setKeepScreenOn({keepScreenOn:!0}),this.TRTC=new TRTC(this)},detached:function(){}},data:{_rtcConfig:{},playerList:[],footerVisible:!0,bottomBoxVisible:!0,evidenceSvg:evidenceSvg,checkSvg:checkSvg,micSvg:micSvg,micOffSvg:micOffSvg,videoSvg:videoSvg,videoOffSvg:videoOffSvg},methods:{init(e,t,s){var i=this.TRTC.createPusher({beautyLevel:9});this.setData({_rtcConfig:{userID:t,sdkAppID:e,userSig:s},pusher:i.pusherAttributes,localAudio:!1,localVideo:!0}),console.log("[GiraffeRtc] : [Funcion Init] : Data"),console.log(this.data._rtcConfig)},enterRoom(e){e=Object.assign(this.data._rtcConfig,{roomID:e});this.setData({pusher:this.TRTC.enterRoom(e)},()=>{this.TRTC.getPusherInstance().start(),console.log(this.data.pusher)})},bindTRTCRoomEvent(){var e=this.TRTC.EVENT;this.TRTC.on(e.LOCAL_JOIN,e=>{console.log("* room LOCAL_JOIN",e),this.data.localVideo&&this.setPusherAttributesHandler({enableCamera:!0}),this.data.localAudio&&this.setPusherAttributesHandler({enableMic:!0})}),this.TRTC.on(e.LOCAL_LEAVE,e=>{console.log("* room LOCAL_LEAVE",e)}),this.TRTC.on(e.ERROR,e=>{console.log("* room ERROR",e)}),this.TRTC.on(e.REMOTE_USER_JOIN,e=>{console.log("* room REMOTE_USER_JOIN",e);var e=e.data["userID"],e=this.data.membernames[e];wx.showToast({title:`${e} 进入了房间`,icon:"none",duration:2e3})}),this.TRTC.on(e.REMOTE_USER_LEAVE,e=>{console.log("* room REMOTE_USER_LEAVE",e);var{userID:t,playerList:e}=e.data;this.setData({playerList:e});t=this.data.membernames[t];wx.showToast({title:`${t} 离开了房间`,icon:"none",duration:2e3})}),this.TRTC.on(e.REMOTE_VIDEO_ADD,e=>{console.log("* room REMOTE_VIDEO_ADD",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteVideo:!1})}),this.TRTC.on(e.REMOTE_VIDEO_REMOVE,e=>{console.log("* room REMOTE_VIDEO_REMOVE",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteVideo:!0})}),this.TRTC.on(e.REMOTE_AUDIO_ADD,e=>{console.log("* room REMOTE_AUDIO_ADD",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteAudio:!1})}),this.TRTC.on(e.REMOTE_AUDIO_REMOVE,e=>{console.log("* room REMOTE_AUDIO_REMOVE",e);var e=e.data["player"];this.setPlayerAttributesHandler(e,{muteAudio:!0})}),this.TRTC.on(e.REMOTE_AUDIO_VOLUME_UPDATE,e=>{console.log("* room REMOTE_AUDIO_VOLUME_UPDATE",e);var e=e.data["playerList"];this.setData({playerList:e})}),this.TRTC.on(e.LOCAL_AUDIO_VOLUME_UPDATE,e=>{var e=e.data["pusher"];this.setData({pusher:e})})},exitRoom(){this.TRTC.exitRoom(),this.triggerEvent("exitRoom")},setPusherAttributesHandler(e){this.setData({pusher:this.TRTC.setPusherAttributes(e)}),console.log(this.data.pusher)},setPlayerAttributesHandler(e,t){this.setData({playerList:this.TRTC.setPlayerAttributes(e.streamID,t)})},getAudioStatus(){return this.data.pusher.enableMic},getVideoStatus(){return this.data.pusher.enableCamera},_fullScreen(e){const t=e.currentTarget.dataset.value;e=[...this.data.playerList].map(e=>(e.id===t.id?(e.isFull?(this.setData({bottomBoxVisible:!0}),this.triggerEvent("fullScreenChange",!0)):(this.setData({bottomBoxVisible:!1}),this.triggerEvent("fullScreenChange",!1)),e.isFull=!e.isFull):e.isFull=!1,e));this.setData({playerList:e})},_mutePlayerAudio(e){e=e.currentTarget.dataset.value;e.hasAudio&&e.muteAudio?this.setPlayerAttributesHandler(e,{muteAudio:!1}):e.hasAudio&&!e.muteAudio&&this.setPlayerAttributesHandler(e,{muteAudio:!0})},_mutePlayerVideo(e){e=e.currentTarget.dataset.value;e.hasVideo&&e.muteVideo?this.setPlayerAttributesHandler(e,{muteVideo:!1}):e.hasVideo&&!e.muteVideo&&this.setPlayerAttributesHandler(e,{muteVideo:!0})},_hangUp(){this.exitRoom()},_setPusherBeautyHandle(){var e=0===this.data.pusher.beautyLevel?9:0;this.setPusherAttributesHandler({beautyLevel:e})},_pusherAudioHandler(){this.data.pusher.enableMic?(this.setPusherAttributesHandler({enableMic:!1}),this.triggerEvent("localAudioChange",!1)):(this.setPusherAttributesHandler({enableMic:!0}),this.triggerEvent("localAudioChange",!0))},_pusherVideoHandler(){this.data.pusher.enableCamera?(this.setPusherAttributesHandler({enableCamera:!1}),this.triggerEvent("localVideoChange",!1)):(this.setPusherAttributesHandler({enableCamera:!0}),this.triggerEvent("localVideoChange",!0))},_switchMemberListPanel(){this.setData({show_memberList:!0})},_handleClose(){this.setData({show_memberList:!1,show_caseinfo:!1})},_pusherStateChangeHandler(e){this.TRTC.pusherEventHandler(e)},_pusherNetStatusHandler(e){this.TRTC.pusherNetStatusHandler(e)},_pusherErrorHandler(e){console.log("推流失败"),this.TRTC.pusherErrorHandler(e)},_pusherBGMStartHandler(e){this.TRTC.pusherBGMStartHandler(e)},_pusherBGMProgressHandler(e){this.TRTC.pusherBGMProgressHandler(e)},_pusherBGMCompleteHandler(e){this.TRTC.pusherBGMCompleteHandler(e)},_pusherAudioVolumeNotify(e){this.TRTC.pusherAudioVolumeNotify(e)},_playerStateChange(e){this.TRTC.playerEventHandler(e)},_playerFullscreenChange(e){this.TRTC.playerFullscreenChange(e)},_playerNetStatus(e){this.TRTC.playerNetStatus(e)},_playerAudioVolumeNotify(e){this.TRTC.playerAudioVolumeNotify(e)}},behaviors:["wx://component-export"],export(){return{exitRoom:this.exitRoom.bind(this),getAudioStatus:this.getAudioStatus.bind(this),getVideoStatus:this.getVideoStatus.bind(this),setLocalAudio:this._pusherAudioHandler.bind(this),setLocalVideo:this._pusherVideoHandler.bind(this)}}}); |
{ | ||
"name": "giraffetrtcmp", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
336917