Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化建议 #71

Open
jack200111 opened this issue Aug 2, 2024 · 2 comments
Open

优化建议 #71

jack200111 opened this issue Aug 2, 2024 · 2 comments

Comments

@jack200111
Copy link

我发现每次创建一个播放器的时候,会多添加一份新的css文件和js文件
1722564635359

@langyuxiansheng
Copy link
Owner

感谢反馈,已收到~, 尽快处理

@jack200111 jack200111 reopened this Aug 2, 2024
@jack200111
Copy link
Author

jack200111 commented Aug 2, 2024

<!-- //(可选)如果您的使用场景需要用到H5模式的播放器,则需引用此css文件。 -->
<link rel="stylesheet" href="https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css" />
<!-- //(必须)引入js文件。 -->
<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>
<template>
  <div class="">
    <div id="J_prismPlayer" />
    <!-- 增加一项容器 -->
    <el-button @click="add">增加一个视频</el-button>
    <div :id="id2" />
  </div>
</template>

<script>

export default {
  data() {
    return {
      id2: 'J_prismPlayer' + Math.floor(Math.random() * 1000)
    }
  },
  mounted() {
    new Aliplayer({
      id: 'J_prismPlayer',
      source: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8', // 播放地址,可以是第三方点播地址,或阿
    });
  },
  methods: {
    add() {
      new Aliplayer({
        id: this.id2,
        source: '//d2zihajmogu5jn.cloudfront.net/elephantsdream/hls/ed_hd.m3u8', // 播放地址,可以是第三方点播地址,或阿里云点播服务中的播放地址。
        // isLive: true, // 是否为直播,默认为false
      })
    }
  }
}
</script>

image
经测试发现,同样new Aliplayer绑定到id的时候,就会增加一份css和js引入

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants