今天我们来看看Aliplayer(阿里云Web播放器)的实际调试代码 ,因Aliplayer支持Flash和Html5两种播放技术,兼容性不一样,所有在实际运用的时候,大家可按需选择!

支持格式:(阿里云Web播放器SDK,同时支持Flash和Html5两种播放技术。)

Flash 模式(已停止更新):
视频格式:mp4、flv、m3u8、rtmp
视频编码:H.264
音频编码:AAC、MP3
音频格式:MP3
HTML5 模式:

视频格式:mp4、m3u8、flv
视频编码:H.264
音频编码:AAC
音频格式:mp3

[wm_wpbutton link="https://help.aliyun.com/document_detail/125570.html" target="blank" variation="yellow"]更多文档说明[/wm_wpbutton]

 

Flash直播演示实例:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<title>Aliplayer Online Settings</title>
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.8/skins/default/aliplayer-min.css" />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.8.8/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
var player = new Aliplayer({
  "id": "player-con",
  "source": "http://cctvalih5ca.v.myalicdn.com/live/cctv13_2/index.m3u8",//播放地址,支持MP4、m3u8
  "width": "100%",
  "height": "500px",
  "autoplay": true,
  "isLive": true,
  "rePlay": false,
  "showBuffer": true,
  "snapshot": false,
  "showBarTime": 5000,
  "useFlashPrism": true,
  "skinLayout": [
    {
      "name": "bigPlayButton",
      "align": "blabs",
      "x": 30,
      "y": 80
    },
    {
      "name": "errorDisplay",
      "align": "tlabs",
      "x": 0,
      "y": 0
    },
    {
      "name": "infoDisplay"
    },
    {
      "name": "controlBar",
      "align": "blabs",
      "x": 0,
      "y": 0,
      "children": [
        {
          "name": "liveDisplay",
          "align": "tlabs",
          "x": 15,
          "y": 25
        },
        {
          "name": "fullScreenButton",
          "align": "tr",
          "x": 10,
          "y": 25
        },
        {
          "name": "volume",
          "align": "tr",
          "x": 10,
          "y": 25
        }
      ]
    }
  ]
}, function (player) {
    console.log("The player is created");
  }
);
</script>
</body>

实际使用时可以吧播放地址改成:“<?php echo($_REQUEST['url']);?>'”那么调用的时候,就是文件链接地址在结尾加上“?url=”加视频地址就可以播放了;此方法使用所有播放器项目哦,下面演示也是参考这里

Html5点播演示实例:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<title>Aliplayer Online Settings</title>
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.8/skins/default/aliplayer-min.css" />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.8.8/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
var player = new Aliplayer({
  "id": "player-con",
  "source": "https://www.coolcoolcloud.com/btjson.m3u8",//点播地址,使用情参考上面的方法
  "width": "100%",
  "height": "500px",
  "autoplay": true,
  "isLive": false,
  "rePlay": false,
  "playsinline": true,
  "preload": true,
  "controlBarVisibility": "hover",
  "useH5Prism": true
}, function (player) {
    console.log("The player is created");
  }
);
</script>
</body>
1.使用本站下载的源码仅限于个人学习和非商业用途。
2.禁止将本站下载的源码用于搭建或支持任何违法、淫秽、暴力或侵犯他人合法权益的网站或应用。
3.使用本站下载的源码需遵守国家法律法规及相关规定,不得从事任何违法活动。
4.如若本站内容侵犯了原著者的合法权益,请联系我们进行处理。