更新记录

1.0.0(2025-05-20)

  • 发布插件

平台兼容性

uni-app(4.66)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - 5.0 × ×
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - -

uni-app x(4.66)

Chrome Safari Android iOS 鸿蒙 微信小程序
- - 5.0 × × -

温馨提示 如何调用插件

  import {
  push,
  stop
} from "@/uni_modules/yuange-screenRtcPush"

开始录屏推流

 push(
  1280, //分辨率宽度,若传0默认自动设置手机屏幕的宽高
  720, //分辨率高度,若传0默认自动设置手机屏幕的宽高
  25, //fps
  "http://192.168.31.10:1985", //rtc api地址:xxxxx/rtc/v1/publish/
  "webrtc://192.168.31.10/live/livestream", //webrtc streamUrl
  true,  // 是否开启语音,支持通话
  {
    success(res) {
      console.log(JSON.stringify(res));
    },
    fail(err) {
      console.log(JSON.stringify(err));
    }
  })

停止推流

stop({
  success(res) {
    console.log(JSON.stringify(res));
  },
  fail(err) {
    console.log(JSON.stringify(err));
  }
})

Demo示例

<template>
  <button @click="push_" class="button">录屏webrtc推流</button>
  <button @click="stop_" class="button">停止推流</button>

  <view class="text-area">
    <text class="title">{{msg}}</text>
  </view>
</template>

<script>
  import {
    push,
    stop
  } from "@/uni_modules/yuange-screenRtcPush"

  export default {
    data() {
      return {
        msg: ""
      }
    },
    methods: {
      push_() {
        let that = this;
        push(
          1280,
          720,
          25,
          "http://192.168.31.10:1985",
          "webrtc://192.168.31.10/live/livestream",
          true, {
            success(res) {
              console.log(JSON.stringify(res));
              that.msg = JSON.stringify(res);
            },
            fail(err) {
              console.log(JSON.stringify(err));
              that.msg = JSON.stringify(err);
            }
          })
      },
      stop_() {
        let that = this;
        stop({
          success(res) {
            console.log(JSON.stringify(res));
            that.msg = JSON.stringify(res);
          },
          fail(err) {
            console.log(JSON.stringify(err));
            that.msg = JSON.stringify(err);
          }
        })
      },
    }
  }
</script>

<style>
  .title {
    font-size: 36rpx;
    color: black;
  }

  .button {
    background-color: dodgerblue;
    color: white;
  }
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

android.permission.RECORD_AUDIO

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问