2017-03-05 140 views
0

逗人,视频和音频(IE)浏览器

我做了HTML帮手播放视频和音频

,当我从(7默认)改为(9,10或边缘),它确实能正常工作 我如何解决它是最新的。 我需要做什么?

这是我的代码助手

public static IHtmlString Media(this HtmlHelper helper, string width, string height, string src, bool isYoutubeOrVimeo = false, string type = "video") 
     { 
      if (type == "audio") 
      { 
       return new MvcHtmlString(string.Format(@"<audio controls> 
    <source src='{0}' type='audio/ogg'> 
    <source src='{0}' type='audio/mpeg'> 
<source src='{0}' type='audio/wav'> 
Your browser does not support the audio element. 
</audio>", src)); 

      } 
      else 
      { 
       if (isYoutubeOrVimeo == false) 
       { 
        return new MvcHtmlString(string.Format(@"<video width='{0}' height='{1}' controls> 
    <source src='{2}' type='video/mp4'> 
    <source src='{2}' type='video/ogg'> 
    <source src='{2}' type='video/webm'> 
Your browser does not support the video tag. 
</video>", width, height, src)); 
       } 
       else 
       { 
        Regex VimeoVideoRegex = new Regex(@"vimeo\.com/(?:.*#|.*/videos/)?([0-9]+)", RegexOptions.IgnoreCase | RegexOptions.Multiline); 
        Regex YoutubeVideoRegex = new Regex(@"^(?:https?\:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v\=))([\w-]{10,12})(?:$|\&|\?\#).*"); 
        Match youtubeMatch = YoutubeVideoRegex.Match(src); 
        Match vimeoMatch = VimeoVideoRegex.Match(src); 
        string id = string.Empty; 
        if (youtubeMatch.Success) 
        { 
         id = youtubeMatch.Groups[1].Value; 
         return new MvcHtmlString(string.Format(@"<iframe width='{0}' height='{1}' src='{2}' frameborder='0' allowfullscreen></iframe>", width, height, "https://www.youtube.com/embed/" + id)); 
        } 
        if (vimeoMatch.Success) 
         id = vimeoMatch.Groups[1].Value; 
        return new MvcHtmlString(string.Format(@"<iframe width='{0}' height='{1}' src='{2}' frameborder='0'></iframe>", width, height, "https://player.vimeo.com/video/" + id)); 
       } 
      } 
     } 

enter image description here

回答

0

首先,使用文件>属性菜单,以确定哪个IE安全区域测试网站被映射到。默认情况下,本地主机子域映射到Internet区域。如果你的本地主机,而不是,映射到Intranet区域,那么将采用默认IE7的仿真模式(见工具>兼容性视图设置>“在兼容性视图中显示Intranet站点”),不支持/渲染HTML5媒体元素和也将只运行32位BHO的,工具栏,或ActiveX控件(粗斜面运行64位代码的32位CPU的)。

从IE转到工具> Internet选项>安全选项卡,拳点击“所有区域重置为默认值”按钮,重置您的开发计算机的浏览器安全设置回自己的工厂或公司GPO的默认值。

然后选择...

Intranet区域>高级按钮,从列表中删除本地主机或127.0.0.1。保存您的更改。

回到IE浏览器,并刷新您的测试网站的页面。使用IE中的文件>属性菜单再次确认它现在映射到INTERNET安全区域。使用IE dev的工具的仿真标签,确认它现在假定边缘仿真模式(IE11)等能够支撑HTML5媒体元素。

但是,您的屏幕截图表明您的BHO甚至没有加载到IE 32位选项卡进程中......您需要同时部署可在32位处理器和64位进程/选项卡上工作的32位和64位版本的BHO ....默认情况下,64位处理器上的IE只会加载64位BHO的标签页,这些标签页会加载映射到Internet(或Restricted)区域的网站。

您的BHO(在没有用户操作的情况下自动注入网页中的内容)很可能会在野外部署时被标记为恶意软件...请参阅以下有关IE Addon开发“最佳实践”的链接。

http://www.enhanceie.com/ie/dev.asp

https://msdn.microsoft.com/en-us/library/gg130949(v=vs.85).aspx