阿里云web端直播(前端部分)

阿里云:Web播放器快速接入_视频点播(VOD)-阿里云帮助中心

javascript 复制代码
import Aliplayer from 'aliyun-aliplayer'

import 'aliyun-aliplayer/build/skins/default/aliplayer-min.css'

    <div id="J_prismPlayer" style="width: 300px; height: 300px;" />

  var player = new Aliplayer({

   id: 'J_prismPlayer',

   source: 'https://playstream.zcwalk.com/AppName/StreamName.flv', // 播放地址,可以是第三方直播地址,或阿里云直播服务中的拉流地址。

   isLive: true, // 是否为直播播放。

   autoplay: true,

   license: {

​    domain: 'zcwalk.com', // 申请 License 时填写的域名

​    key: 'SP6aM3dodVL1ZLX5d5067ef06eb28409d9dbb5b81e8cc6be5' // 申请成功后,在控制台可以看到 License Key

   }

   // LicenseKey: 'SP6aM3dodVL1ZLX5d5067ef06eb28409d9dbb5b81e8cc6be5'

  }, function(player) {

   console.log('The player is created.')

  })

微信小程序直播:

javascript 复制代码
 <live-player id="player" src="https://playstream.zcwalk.com/AppName/StreamName.flv" mode="live" autoplay bindstatechange="statechange" binderror="error" />

 statechange(e) {

  console.log('live-player code:', e.detail.code)

 },

 error(e) {

  console.error('live-player error:', e.detail.errMsg)

 },

 bindPlay() {

  this.ctx.play({

   success: res => {

​    console.log('play success')

   },

   fail: res => {

​    console.log('play fail')

   }

  })

 },

 bindPause() {

  this.ctx.pause({

   success: res => {

​    console.log('pause success')

   },

   fail: res => {

​    console.log('pause fail')

   }

  })

 },

 bindStop() {

  this.ctx.stop({

   success: res => {

​    console.log('stop success')

   },

   fail: res => {

​    console.log('stop fail')

   }

  })

 },

 bindResume() {

  this.ctx.resume({

   success: res => {

​    console.log('resume success')

   },

   fail: res => {

​    console.log('resume fail')

   }

  })

 },

 bindMute() {

  this.ctx.mute({

   success: res => {

​    console.log('mute success')

   },

   fail: res => {

​    console.log('mute fail')

   }

  })

 }
相关推荐
Johny_Zhao2 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
NineData7 小时前
数据库迁移总踩坑?用 NineData 迁移评估,提前识别所有兼容性风险
数据库·程序员·云计算
SaaS_Product5 天前
从实用性与体验角度出发,OneDrive有什么替代品
云计算·saas·onedrive
小扎仙森6 天前
关于阿里云实时语音翻译-Gummy推送WebSocket
websocket·阿里云·云计算
晚秋大魔王6 天前
ubutnu 服务器配置openclaw 使用阿里云百炼模型
运维·服务器·阿里云
Shacoray6 天前
OpenClaw 接入阿里云百炼 Coding Plan 指南
阿里云·ai·云计算·qwen3·openclaw·coding plan
TG_yunshuguoji6 天前
阿里云代理商:2026 年阿里云国际站上云接入指南
服务器·阿里云·云计算
阿里云云原生6 天前
阿里云可观测 2026 年 1 月产品动态
阿里云·云计算
TG_yunshuguoji6 天前
亚马逊云代理商:AWS 国际站缺卡新用户创建邮箱怎么选择?
安全·云计算·aws
峰顶听歌的鲸鱼6 天前
Zabbix监控系统
linux·运维·笔记·安全·云计算·zabbix·学习方法