NodePlyer.js 文档
NodeMediaEdge 文档
NodeMediaServer 文档
NodeMediaClient-iOS 文档
NodeMediaClient-Android 文档
NodeMediaClient-Windows 文档
UsionMediaServer文档
OpenHarmony_5.0 / HarmonyOS_NEXT 平台的低延迟直播播放组件
使用DevEco打开项目后,点击下方Terminal,输入命令安装依赖
ohpm install @nodemedia/nodemediaclient
或者通过nodemedia自建仓库安装
ohpm install @nodemedia/nodemediaclient --registry https://repo.nodemedia.cn/repos/ohpm
import { router } from '@kit.ArkUI';import { NodePlayer, NodePlayerController } from '@nodemedia/nodemediaclient';@Entry@Componentstruct VideoViewPage { // @State src: string = 'rtmp://192.168.0.2/live/bbb'; // @State src: string = 'rtsp://admin:admin@192.168.0.2/Streaming/Channels/101'; @State src: string = 'https://192.168.0.2:8443/live/imu.flv'; private license: string = ''; private controller: NodePlayerController = new NodePlayerController(); build() { Column() { Button("Back").onClick(() => { router.back() }) NodePlayer({ license: this.license, src: this.src, scaleMode: 1, bufferTime: 1000, controller: this.controller, onEvent: (code: number, msg: string) => { console.info('NodePlayer on event, code:' + code, 'message:' + msg); } }) .width('100%') .height('40%') TextInput({ text: this.src }) .onChange((v)=>{ this.src = v; }) .padding('10') Row() { Button("开始播放") .onClick(() => { this.controller.start() }) Button("停止播放") .onClick(() => { this.controller.stop() }) } } .padding('10') }}
import { router } from '@kit.ArkUI';
import { NodePlayer, NodePlayerController } from '@nodemedia/nodemediaclient';
@Entry
@Component
struct VideoViewPage {
// @State src: string = 'rtmp://192.168.0.2/live/bbb';
// @State src: string = 'rtsp://admin:admin@192.168.0.2/Streaming/Channels/101';
@State src: string = 'https://192.168.0.2:8443/live/imu.flv';
private license: string = '';
private controller: NodePlayerController = new NodePlayerController();
build() {
Column() {
Button("Back").onClick(() => {
router.back()
})
NodePlayer({
license: this.license,
src: this.src,
scaleMode: 1,
bufferTime: 1000,
controller: this.controller,
onEvent: (code: number, msg: string) => {
console.info('NodePlayer on event, code:' + code, 'message:' + msg);
}
.width('100%')
.height('40%')
TextInput({ text: this.src })
.onChange((v)=>{
this.src = v;
.padding('10')
Row() {
Button("开始播放")
.onClick(() => {
this.controller.start()
Button("停止播放")
this.controller.stop()
"requestPermissions": [ { "name": "ohos.permission.INTERNET" } ],
"requestPermissions": [
{
"name": "ohos.permission.INTERNET"
],
OpenHarmony_5.0 / HarmonyOS_NEXT 平台的低延迟直播推流组件
QQ客服:281269007
扫码加微信