开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 212|回复: 6
收起左侧

[Web相关] 大佬帮我把一个视频地址改成传参,谢谢

[复制链接]
结帖率:96% (51/53)
发表于 昨天 22:34 | 显示全部楼层 |阅读模式   河北省廊坊市
20精币
<!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"  />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.30.3/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
var player = new Aliplayer({
  "id": "player-con",
  "source": "https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8",
  "width": "100%",
  "height": "100%",
  "autoplay": false,
  "isLive": false,
  "cover": "http://img.netbian.com/file/2023/0525/235919GzKfQ.jpg",
  "rePlay": false,
  "videoHeight": undefined,
  "isVBR": undefined,
  "preload": false,
  "controlBarVisibility": "hover",
  "useH5Prism": true
}, function (player) {
    console.log("The player is created");
  }
);
</script>
</body>




上面这个播放器代码 我想把https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8改成外部传参方式,比如地址是http://llocalhost/index.html?V=https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8
这样播放 谁能帮忙修改一下


回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。
友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
快捷通道:申请荣誉值无答案申请取消悬赏投诉有答案未采纳为最佳
结帖率:97% (369/381)

签到天数: 5 天

发表于 昨天 23:49 | 显示全部楼层   福建省泉州市

[HTML] 纯文本查看 复制代码
<!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"  />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.30.3/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
// 从URL参数中获取视频源地址
function getQueryParam(name) {
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(window.location.search);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

// 获取视频源参数,如果没有则使用默认值
var videoSource = getQueryParam('V') || "https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8";

var player = new Aliplayer({
  "id": "player-con",
  "source": videoSource,
  "width": "100%",
  "height": "100%",
  "autoplay": false,
  "isLive": false,
  "cover": "http://img.netbian.com/file/2023/0525/235919GzKfQ.jpg",
  "rePlay": false,
  "videoHeight": undefined,
  "isVBR": undefined,
  "preload": false,
  "controlBarVisibility": "hover",
  "useH5Prism": true
}, function (player) {
    console.log("The player is created");
  }
);
</script>
</body>
</html>
回复

使用道具 举报

结帖率:96% (51/53)

签到天数: 5 天

 楼主| 发表于 23 小时前 | 显示全部楼层   河北省廊坊市
深爱者 发表于 2025-5-4 23:49
[mw_shl_code=html,true]

播放错误...我是从阿里播放器官网复制的代码 ...
回复

使用道具 举报

结帖率:54% (7/13)

签到天数: 5 天

发表于 23 小时前 | 显示全部楼层   浙江省嘉兴市
[HTML] 纯文本查看 复制代码
<!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"  />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.30.3/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
function getQueryParam(name) {
    const urlParams = new URLSearchParams(window.location.search);
    return urlParams.get(name);
}

const videoUrl = getQueryParam('V') || 'https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8';

var player = new Aliplayer({
  "id": "player-con",
  "source": decodeURIComponent(videoUrl)
  "width": "100%",
  "height": "100%",
  "autoplay": false,
  "isLive": false,
  "cover": "http://img.netbian.com/file/2023/0525/235919GzKfQ.jpg",
  "rePlay": false,
  "videoHeight": undefined,
  "isVBR": undefined,
  "preload": false,
  "controlBarVisibility": "hover",
  "useH5Prism": true
}, function (player) {
    console.log("The player is created");
  }
);
</script>
</body>
</html>

回复

使用道具 举报

结帖率:96% (51/53)

签到天数: 5 天

 楼主| 发表于 20 小时前 | 显示全部楼层   河北省廊坊市

白屏~~
回复

使用道具 举报

结帖率:33% (1/3)

签到天数: 3 天

发表于 14 小时前 | 显示全部楼层   山东省菏泽市
[HTML] 纯文本查看 复制代码
<!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>
    <script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.30.3/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
// 获取URL参数函数
function getQueryParam(name) {
    const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    const r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURIComponent(r[2]);
    return null;
}

// 从URL参数获取播放地址
const videoSource = getQueryParam('source') || 'https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8';

var player = new Aliplayer({
    "id": "player-con",
    "source": videoSource, // 使用参数传递的播放地址
    "width": "100%",
    "height": "100%",
    "autoplay": false,
    "isLive": false,
    "cover": "http://img.netbian.com/file/2023/0525/235919GzKfQ.jpg",
    "rePlay": false,
    "preload": false,
    "controlBarVisibility": "hover",
    "useH5Prism": true
}, function (player) {
    console.log("播放器创建完成");
    // 可以在这里添加错误处理
    player.on('error', function(e) {
        console.error('播放错误:', e);
        alert('视频加载失败,请检查播放地址');
    });
});
</script>
</body>
</html>

访问 http://127.0.0.1/py.html?source=https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8 试试吧  ,你这个代码貌似缺少css布局文件  这边测试可以正常播放
回复

使用道具 举报

结帖率:89% (39/44)

签到天数: 5 天

发表于 6 分钟前 | 显示全部楼层   河北省衡水市
[JavaScript] 纯文本查看 复制代码
<!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"  />
<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.30.3/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script>
// Function to get URL parameters
function getUrlParameter(name) {
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(window.location.href);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

// Get the video URL from the 'V' parameter
var videoUrl = getUrlParameter('V') || "https://mfqcb.zyzqcb.cc/Vtche/RY/4205083878.m3u8";

var player = new Aliplayer({
  "id": "player-con",
  "source": videoUrl,
  "width": "100%",
  "height": "100%",
  "autoplay": false,
  "isLive": false,
  "cover": "http://img.netbian.com/file/2023/0525/235919GzKfQ.jpg",
  "rePlay": false,
  "videoHeight": undefined,
  "isVBR": undefined,
  "preload": false,
  "controlBarVisibility": "hover",
  "useH5Prism": true
}, function (player) {
    console.log("The player is created");
  }
);
</script>
</body>
</html>

回复

使用道具 举报

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

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

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