Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用文件<;在IE10中设置HTML5 Video.Src时源代码无效;输入>;使用createObjectURL()_Video_Input_Internet Explorer 10_Local Files - Fatal编程技术网

使用文件<;在IE10中设置HTML5 Video.Src时源代码无效;输入>;使用createObjectURL()

使用文件<;在IE10中设置HTML5 Video.Src时源代码无效;输入>;使用createObjectURL(),video,input,internet-explorer-10,local-files,Video,Input,Internet Explorer 10,Local Files,当使用createObjectURL()生成文件路径,将的src设置为本地视频文件时,Internet Explorer 10是否存在此问题 错误:Internet Explorer 10给出错误“无效源” 示例:我有一个简单的html示例,可以在ChromeV27和FirefoxV21中使用,但不能在InternetExplorerV10中使用 当前解决方法:将域添加到IE10可信站点,然后引用的“值”(包括我的示例)。但是window.URL.createObjectURL()功能肯定是为了

当使用createObjectURL()生成文件路径,将的src设置为本地视频文件时,Internet Explorer 10是否存在此问题

错误:Internet Explorer 10给出错误“无效源”

示例:我有一个简单的html示例,可以在ChromeV27和FirefoxV21中使用,但不能在InternetExplorerV10中使用

当前解决方法:将域添加到IE10可信站点,然后引用的“值”(包括我的示例)。但是window.URL.createObjectURL()功能肯定是为了避免这种情况而设计的。奇怪的是
var createObjectURL=(window.URL&&URL.createObjectURL.bind(URL))|| (window.webkitURL&&webkitURL.createObjectURL.bind(webkitURL))| window.createObjectURL; 函数handleVideoFileBrowse(目标) { var url=createObjectURL(target.files[0]);//适用于Chrome v27和Firefox v21,但不适用于Internet Explorer v10.0.9200 //url=target.value;//我的IE 10临时解决方案,但只有在IE:Internet选项-安全性-受信任站点中将域添加为受信任域时才有效。 document.getElementById(“videoElement”).src=url; }
    <!DOCTYPE html>
    <html>
        <head>
            <title>Internet Explorer 10 : HTML5 Video.Src : 'Invalid Source' error when setting local file as source using createObjectURL()</title>
        </head>
        <body>

            <input type="file" id="filesInputVideo" name="files[]" onchange="handleVideoFileBrowse(event.target)" /> <br />
            <video id="videoElement" width="350" style="border-style: solid" controls></video>

            <script type="text/javascript">

                var createObjectURL = (window.URL && URL.createObjectURL.bind(URL)) ||
                                      (window.webkitURL && webkitURL.createObjectURL.bind(webkitURL)) || 
                                      window.createObjectURL;

                function handleVideoFileBrowse(target) 
                {
                    var url = createObjectURL(target.files[0]); // Works in Chrome v27 and Firefox v21, but NOT in Internet Explorer v10.0.9200

                    //url = target.value; // My temporary workaround for IE 10, but only works if the domain has been added as Trusted in IE: Internet Options - Security - Trusted sites.

                    document.getElementById("videoElement").src = url;
                }
            </script>

        </body>
    </html>