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

【求助】VUE2视频截图报错 #320

Open
JaneYork opened this issue Nov 28, 2023 · 1 comment
Open

【求助】VUE2视频截图报错 #320

JaneYork opened this issue Nov 28, 2023 · 1 comment

Comments

@JaneYork
Copy link

JaneYork commented Nov 28, 2023

示例代码

      this.player = new Aliplayer(props, (player) => {
        console.log('播放器初始化完成', player)
        // 添加截图事件监听器
        player.on('snapshoted', (data) => {
          console.log('截图完成', data)
          this.handleSnapshot(data)
        })
      })
    handleSnapshot(data) {
      // 处理截图数据,可以将数据保存到组件的变量中
      console.log('截图完成', data)
      var pictureData = data.paramData.base64
      var downloadElement = document.createElement('a')
      downloadElement.setAttribute('href', pictureData)
      var fileName = 'Aliplayer' + Date.now() + '.png'
      downloadElement.setAttribute('download', fileName)
      downloadElement.click()
      pictureData = null
      // 执行其他操作...
    },

报错内容

{
    "type": "snapshoted",
    "target": {
        "vdata1701140826521": "1B08F21A-CE0F-44B4-A668-64CC37C2CC4B",
        "paramData": null
    },
    "paramData": {
        "time": 11.01612,
        "base64": "",
        "binary": "",
        "error": {
            "stack": "Error: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.\n    at t.<anonymous> (https://g.alicdn.com/apsara-media-box/imp-web-player/2.18.3/aliplayer-min.js:2:614027)\n    at HTMLDivElement.i (https://g.alicdn.com/apsara-media-box/imp-web-player/2.18.3/aliplayer-min.js:2:105799)\n    at a.dispatcher.a.dispatcher (https://g.alicdn.com/apsara-media-box/imp-web-player/2.18.3/aliplayer-min.js:2:95256)"
        }
    },
    "defaultPrevented": false
}
@raxxarr
Copy link
Collaborator

raxxarr commented Mar 6, 2024

需要传入 extraInfo 来允许跨域,可以参考文档:https://help.aliyun.com/zh/vod/developer-reference/advanced-features-3#p-6e6-unl-31c

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