Ionic 3,videojs-panorama 在 Android 中不支持出现错误 DOMException: Failed to execute 'texImage2D' on [英] Ionic 3 , videojs-panorama not supporting in Android getting error DOMException: Failed to execute 'texImage2D' on

查看:22
本文介绍了Ionic 3,videojs-panorama 在 Android 中不支持出现错误 DOMException: Failed to execute 'texImage2D' on的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用时出现此错误视频-全景

I am getting this error when using videos-panorama

Dom 异常:无法在WebGLRenderingContext"上执行texImage2D":视频元素包含跨域数据,可能无法加载.

Dom Exception: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The video element contains cross-origin data, and may not be loaded.

https://github.com/yanwsh/videojs-panorama

<代码>

<code>


(功能(窗口,videojs){var player = window.player = videojs('videojs-panorama-player', {}, function () {});var videoElement = document.getElementById("videojs-panorama-player");var 宽度 = videoElement.offsetWidth;var height = videoElement.offsetHeight;player.width(宽度),player.height(高度);播放器.全景({点击并拖动:真,返回垂直中心:假,backToHorizo​​nCenter:假,clickToToggle:真,最大纬度:-10,initLat:-10,初始化:-270,旋转X:-Math.PI,通知消息:(isMobile())?"请拖放视频" : "请用鼠标拖放视频",视频类型:鱼眼",回调:函数(){播放器.play();}});}(窗口,window.videojs));


(function (window, videojs) { var player = window.player = videojs('videojs-panorama-player', {}, function () { }); var videoElement = document.getElementById("videojs-panorama-player"); var width = videoElement.offsetWidth; var height = videoElement.offsetHeight; player.width(width), player.height(height); player.panorama({ clickAndDrag: true, backToVerticalCenter: false, backToHorizonCenter: false, clickToToggle: true, maxLat: -10, initLat: -10, initLon: -270, rotateX: -Math.PI, NoticeMessage: (isMobile()) ? "please drag and drop the video" : "please use your mouse drag and drop the video", videoType: "fisheye", callback: function () { player.play(); } }); }(window, window.videojs));

推荐答案

这里解释一下CORS"的概念:https://developer.mozilla.org/en-US/docs/网络/HTTP/CORS

The concept of "CORS" is explained here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Stack-Overflow 上有一个较早的线程在这里讨论这个问题:在.htaccess中启用cors

There is an earlier thread here on Stack-Overflow discussing this here: enable cors in .htaccess

归根结底,大多数网络服务器都很高兴,如果你只是为他们提供一个名为的两行文件.htaccess",包含这两行:

To boil it all down, most webservers are happy, if you just supply them with a two-line file named ".htaccess", containing these 2 lines:

标头添加 Access-Control-Allow-Origin "*"

Header add Access-Control-Allow-Origin "*"

标头添加 Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"

Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"

这篇关于Ionic 3,videojs-panorama 在 Android 中不支持出现错误 DOMException: Failed to execute 'texImage2D' on的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆