阿里云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')

   }

  })

 }
相关推荐
AKAMAI17 小时前
Akamai 块存储:低延迟、高可靠的云原生持久存储方案
云计算
AOwhisky18 小时前
MySQL 学习笔记(第六期):MySQL 备份与恢复
运维·数据库·笔记·学习·mysql·云计算
sbjdhjd1 天前
04(上)| k8s中的微服务
微服务·云原生·kubernetes·开源·云计算·excel·kubelet
主机哥哥1 天前
2026年阿里云618活动优惠政策详细解读
阿里云
有什么事1 天前
云端虚拟手机:未来移动计算新革命
人工智能·智能手机·云计算
大任视点1 天前
智绘秀番与腾讯云达成战略合作,推动 AI 动漫生产进入 Agent 协同时代
人工智能·云计算·腾讯云
翼龙云_cloud1 天前
腾讯云代理商:腾讯云CloudBase操作常见问题解答
云计算·腾讯云·ai智能体
Database_Cool_1 天前
AI 时代的数据仓库:阿里云 AnalyticDB MySQL 向量检索 + SQL 分析一体化实战
数据仓库·人工智能·mysql·阿里云
Database_Cool_1 天前
Doris vs 阿里云 AnalyticDB MySQL vs ClickHouse:3 大 OLAP 产品 2026 深度对比
数据库·mysql·阿里云
Database_Cool_1 天前
PB 级数据实时分析:阿里云 AnalyticDB MySQL Serverless 弹性架构深度解析
阿里云·架构·云计算