iOSVideoView.nvue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view>
  3. <view class="SvideoView">
  4. <wrs-uts-webrtc-view ref='localView' :style="'width:'+width+'px;height:'+height+'px;'"
  5. @onLoadView="onLoadLocalView"></wrs-uts-webrtc-view>
  6. </view>
  7. <wrs-uts-webrtc-view ref='remoteView' :style="'width:'+windowWidth+'px;height:'+windowHeight+'px;'"
  8. @onLoadView="onLoadRemoteView"></wrs-uts-webrtc-view>
  9. <view class="bottomfloatV">
  10. <view class="cInRowS" style="width: 700rpx;margin-left: 25rpx;">
  11. <image style="width: 100rpx;height: 100rpx;" src="/static/mine/qiehunsxt.png" mode="scaleToFill" @click="switchCamera"></image>
  12. <image style="width: 100rpx;height: 100rpx;margin-left: 40rpx;" src="/static/mine/icon_off.png" mode="scaleToFill" @click="guangduan"></image>
  13. <!-- <image style="width: 100rpx;height: 100rpx;margin-left: 40rpx;" src="/static/mine/ysq_off.png" mode="scaleToFill" @click="jingyin"></image> -->
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. const {
  22. windowWidth,
  23. windowHeight
  24. } = uni.getSystemInfoSync();
  25. let height = windowWidth / (16.0 / 9.0);
  26. return {
  27. width: windowWidth/2.5,
  28. height: height,
  29. windowWidth: windowWidth,
  30. windowHeight: windowHeight,
  31. isFront: true,
  32. friendId:''
  33. }
  34. },
  35. onLoad(option) {
  36. this.friendId = option.friendId;
  37. },
  38. methods: {
  39. pause(){
  40. this.$refs.localView.stopCapture()
  41. },
  42. resume(){
  43. this.$refs.localView.resumeCapture()
  44. },
  45. onLoadLocalView(p) {
  46. console.log("onLoadLocalView")
  47. // 渲染本地视频界面
  48. this.$refs.localView.renderLocalVideo()
  49. },
  50. onLoadRemoteView(p) {
  51. console.log("显示远程视频流:" + this.friendId)
  52. var that = this;
  53. setTimeout(function() {
  54. that.$refs.remoteView.renderRemoteVideo(that.friendId)
  55. }, 1300);
  56. },
  57. switchCamera(){
  58. this.isFront = !this.isFront
  59. this.$refs.localView.switchCamera(this.isFront)
  60. },
  61. guangduan(){
  62. uni.navigateBack();
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. .container {
  69. display: flex;
  70. flex-direction: row;
  71. }
  72. .SvideoView{
  73. position: fixed;
  74. flex-direction: row;
  75. align-items: center;
  76. right: 0;
  77. top: 0;
  78. z-index: 999;
  79. }
  80. .bottomfloatV{
  81. position: fixed;
  82. flex-direction: row;
  83. align-items: center;
  84. left: 0;
  85. right: 0;
  86. bottom: 0;
  87. z-index: 999;
  88. height: 180rpx;
  89. }
  90. .cInRowS{
  91. display: flex;
  92. flex-direction: row;
  93. align-items: center;
  94. justify-content:space-between;
  95. }
  96. </style>