Ionic 3 , videojs-panorama not supporting in Android getting error DOMException: Failed to execute 'texImage2D' on

二次信任 提交于 2020-01-11 13:47:08

问题


I am getting this error when using videos-panorama

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>


(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));


回答1:


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

There is an earlier thread here on Stack-Overflow discussing this here: enable cors in .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:

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

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



来源:https://stackoverflow.com/questions/58691058/ionic-3-videojs-panorama-not-supporting-in-android-getting-error-domexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!