找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 784|回复: 36

[其它网络视频相关] 请问这个播放器代码为什么不显示播放器

[复制链接]
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>Web播放器SDK示例</title>
  5.   <meta charset="UTF-8">
  6.   <script charset="utf-8" type="text/javascript" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js"></script>
  7.   <link rel="stylesheet" href="https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css" />
  8. </head>
  9. <body>
  10.   <div id="player-container"></div>
  11.   <input type="text" id="video-url-input" placeholder="输入视频文件的URL">
  12.   <button onclick="playVideo()">播放</button>

  13.   <script>
  14.     var player;

  15.     function playVideo() {
  16.       var videoUrl = document.getElementById('video-url-input').value;

  17.       if (player) {
  18.         player.dispose(); // 清除之前的播放器实例
  19.       }

  20.       player = new Aliplayer({
  21.         id: 'player-container',
  22.         source: videoUrl,
  23.         width: '100%',
  24.         height: '100%',
  25.         autoplay: true,
  26.         language: 'zh-cn', // 设置播放器语言为中文
  27.         skinLayout: [
  28.           { name: 'bigPlayButton', align: 'blabs', x: 30, y: 80 },
  29.           { name: 'H5Loading', align: 'cc' },
  30.           { name: 'errorDisplay', align: 'tlabs', x: 0, y: 0 },
  31.           { name: 'infoDisplay' },
  32.           { name: 'tooltip', align: 'blabs', x: 0, y: 56 },
  33.           { name: 'thumbnail' }
  34.         ],
  35.         playsinline: true, // 在iOS Safari中启用内联播放
  36.         cover: '<封面图片URL>', // 设置封面图片URL
  37.         format: 'auto' // 自动选择播放格式,可选值:'auto'、'm3u8'、'mp4'
  38.       });

  39.       player.on('ready', function() {
  40.         player.play();
  41.       });
  42.     }
  43.   </script>
  44. </body>
  45. </html>
复制代码
打开后只有输入框,没播放器界面,输入视频链接后有声音,还是不显示播放器,修改了几十次都没解决,请问有大佬知道原因吗?
我的恩山、我的无线 The best wifi forum is right here.
阿里云的播放器
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

删除<!DOCTYPE html>试试

点评

删除了还是不显示  详情 回复 发表于 2023-9-3 13:26
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

width: '100%',
height: '100%',

使用具体的px。

点评

也不行  详情 回复 发表于 2023-9-3 13:26
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 zxjung 于 2023-9-3 13:50 编辑


<!DOCTYPE html>
<html>
<head>
  <title>阿里云播放器</title>
  <meta charset="UTF-8">
  <script charset="utf-8" type="text/javascript" src="https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js"></script>
  <link rel="stylesheet" href="https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css" />
</head>
<body>
  <div id="al"></div>
  <script>
    var  player = new Aliplayer({
        id: 'al',
        source: 'https://cfss.cc/api/kw/69284035.mp4',
        width: '98%',
        height: '1080px',
        autoplay: true,
        playsinline: true, // 在iOS Safari中启用内联播放
        cover: '<封面图片URL>', // 设置封面图片URL
        format: 'auto' // 自动选择播放格式,可选值:'auto'、'm3u8'、'mp4'
      });
  </script>
</body>
</html>

给你简单化了 怎么样OK

点评

还是不显示呀,你那里可以显示吗?  详情 回复 发表于 2023-9-3 13:28
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
guoma 发表于 2023-9-3 12:37
删除试试

删除了还是不显示
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
jiteloozz 发表于 2023-9-3 12:47
width: '100%',
height: '100%',


也不行
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
zxjung 发表于 2023-9-3 13:02
播放器
  
  

还是不显示呀,你那里可以显示吗?

点评

可以的 你空间没有HTTPS 吧  详情 回复 发表于 2023-9-3 13:53
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

是不是你的浏览器问题?

点评

你测试可以吗?我用2个浏览器试了  详情 回复 发表于 2023-9-3 13:45
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
guoma 发表于 2023-9-3 13:40
是不是你的浏览器问题?

你测试可以吗?我用2个浏览器试了

点评

把代码里的 改成 看看。  详情 回复 发表于 2023-9-3 13:57
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

mxwz 发表于 2023-9-3 13:28
还是不显示呀,你那里可以显示吗?

可以的 你空间没有HTTPS 吧

点评

是没有https,只有http  详情 回复 发表于 2023-9-3 14:04
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

mxwz 发表于 2023-9-3 13:45
你测试可以吗?我用2个浏览器试了

把代码里的
  <div id="player-container"></div>
改成
  <div id="player-container" style="position:absolute;left:10px;top:40px;"></div>
看看。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 来自手机 | 显示全部楼层
zxjung 发表于 2023-9-3 13:53
可以的 你空间没有HTTPS 吧

是没有https,只有http

点评

复制我的代码在这里测试 https://www.runoob.com/try/try.php?filename=tryhtml_basic_link  详情 回复 发表于 2023-9-3 14:07
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 zxjung 于 2023-9-3 14:13 编辑
mxwz 发表于 2023-9-3 14:04
是没有https,只有http

复制我的代码在这里测试 https://www.runoob.com/try/try.php?filename=tryhtml_basic_link

没有HTTPS要这样


<!DOCTYPE html>
<html>
<head>
  <title>阿里云播放器</title>
  <meta charset="UTF-8">
  <script charset="utf-8" type="text/javascript" src="//g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js"></script>
  <link rel="stylesheet" href="//g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css" />
</head>
<body>
  <div id="al"></div>
  <script>
    var  player = new Aliplayer({
        id: 'al',
        source: '//cfss.cc/api/kw/69284035.mp4',
        width: '98%',
        height: '1080px',
        autoplay: true,
        playsinline: true, // 在iOS Safari中启用内联播放
        cover: '<封面图片URL>', // 设置封面图片URL
        format: 'auto' // 自动选择播放格式,可选值:'auto'、'm3u8'、'mp4'
      });
  </script>
</body>
</html>


点评

用这个也不行  详情 回复 发表于 2023-9-3 14:26
加个定位就可以了。 [attachimg]643206[/attachimg]  详情 回复 发表于 2023-9-3 14:16
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-29 05:06

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

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