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

   }

  })

 }
相关推荐
木斯佳13 小时前
前端八股文面经大全:阿里云AI应用开发一面(2026-03-20)·面经深度解析
前端·人工智能·阿里云·ai·智能体·流式打印
3DVisionary15 小时前
测管即修正!Tube Qualify赋能航空与汽车管路一体化智能在线检测
阿里云·智能手机·汽车·智能制造·航空航天·tubequalify·管路检测
翼龙云_cloud15 小时前
阿里云渠道商:百炼模型选型指南 性能与成本全解析
人工智能·阿里云·云计算
laozhao43217 小时前
阿里云240万中标广东长城证券A计划智能助手项目
阿里云·云计算
爱钓鱼的程序员小郭18 小时前
阿里云自动配置安全组IP白名单
python·tcp/ip·安全·阿里云
爱钓鱼的程序员小郭18 小时前
腾讯云 vs 阿里云 视频直播费用分析报告
阿里云·音视频·腾讯云
灰阳阳18 小时前
Docker实践-阿里云上创建私有仓库
阿里云·docker·容器
阿里云云原生18 小时前
让 OpenClaw 受控运行: SLS 一键接入与审计
阿里云·云原生·sls·openclaw
智星云算力19 小时前
2026年GPU算力平台实测(高性价比排行)
人工智能·阿里云·gpu算力·智星云·gpu租用