找回密码
 立即注册
搜索
查看: 198|回复: 0

[基础语法] 结合西瓜播放器,和DASH协议,写一个demo

[复制链接]

581

主题

110

回帖

4066

积分

管理员

积分
4066

众神之神

发表于 2024-10-14 07:41:24 | 显示全部楼层 |阅读模式
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>西瓜播放器与DASH示例</title>
  7.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xgplayer@latest/dist/xgplayer.min.css">
  8.     <style>
  9.         #xgplayer {
  10.             width: 100%;
  11.             height: auto;
  12.         }
  13.     </style>
  14. </head>
  15. <body>
  16.     <h1>西瓜播放器与DASH协议示例</h1>
  17.     <div id="xgplayer"></div>

  18.     <script src="https://cdn.jsdelivr.net/npm/xgplayer@latest/dist/xgplayer.min.js"></script>
  19.     <script>
  20.         const player = new Player({
  21.             id: 'xgplayer',
  22.             url: 'https://example.com/path/to/your/manifest.mpd', // 替换为您的DASH清单文件URL
  23.             type: 'dash', // 指定视频类型为DASH
  24.             autoplay: true, // 自动播放
  25.             controls: true, // 显示控制条
  26.             width: '100%', // 播放器宽度
  27.             height: 'auto' // 播放器高度
  28.         });
  29.     </script>
  30. </body>
  31. </html>
复制代码
  1. <?php
  2. $inputFile = 'input.mp4';
  3. $outputFile = 'output.mp4';
  4. $command = "ffmpeg -i $inputFile -c:v libx264 -preset fast -crf 22 $outputFile";
  5. exec($command, $output, $return_var);

  6. if ($return_var === 0) {
  7.     echo "转换成功!";
  8. } else {
  9.     echo "转换失败!";
  10. }
  11. ?>
复制代码

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|十三博客 ( 鲁ICP备2023000528号 )

GMT+8, 2026-6-1 17:26 , Processed in 0.054917 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表