vb.net 网络浏览器控件支持哪些视频格式?为什么即使在 IE 中可以播放此视频也无法播放?
Which video formats does the vb.net web browser control support and why won't it play this video even if it works in IE?
我的网络浏览器控件中有这个 html:
<html>
<body>
<video width="450" height="400" controls autoplay="autoplay">
<source src="file:///C:\Rythm\*name*.mp4" type="video/mp4">
Votre navigateur ne prend pas en charge ce format vidéo.
</video>
</body>
</html>
当然,*name*
替换为视频的实际名称。
该代码在 chrome 和 IE 中有效,但在 Web 浏览器控件中无效。
我该如何解决这个问题?
将存储在用户硬盘驱动器上的视频添加到 vb.net 表单的另一种解决方案也将受到赞赏。
问题可能是由于 VB.NET 中的 WebBrowser 默认不使用 IE 11。我尝试在 html <head>
中添加这一行,然后它可以在 VB.NET:
中与 WebBrowser 一起使用
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
示例 HTML 代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title></title>
</head>
<body>
<video width="450" height="400" controls autoplay="autoplay">
<source src="file:///C:\Rythm\*name*.mp4" type="video/mp4">
Votre navigateur ne prend pas en charge ce format vidéo.
</video>
</body>
</html>
VB.NET 形式的结果:
我的网络浏览器控件中有这个 html:
<html>
<body>
<video width="450" height="400" controls autoplay="autoplay">
<source src="file:///C:\Rythm\*name*.mp4" type="video/mp4">
Votre navigateur ne prend pas en charge ce format vidéo.
</video>
</body>
</html>
当然,*name*
替换为视频的实际名称。
该代码在 chrome 和 IE 中有效,但在 Web 浏览器控件中无效。
我该如何解决这个问题?
将存储在用户硬盘驱动器上的视频添加到 vb.net 表单的另一种解决方案也将受到赞赏。
问题可能是由于 VB.NET 中的 WebBrowser 默认不使用 IE 11。我尝试在 html <head>
中添加这一行,然后它可以在 VB.NET:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
示例 HTML 代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title></title>
</head>
<body>
<video width="450" height="400" controls autoplay="autoplay">
<source src="file:///C:\Rythm\*name*.mp4" type="video/mp4">
Votre navigateur ne prend pas en charge ce format vidéo.
</video>
</body>
</html>
VB.NET 形式的结果: