如何在webbrowser控件c#wpf中从本地(不是主机)播放视频 [英] how to play video from local (not in host) in webbrowser control c# wpf

查看:157
本文介绍了如何在webbrowser控件c#wpf中从本地(不是主机)播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有代码播放视频,但它只支持来自网络主机的视频

I have code play video but it support only video from web host

wbViewer.NavigateToString(@"<!DOCTYPE html>
                <html>
                <head>
                    <meta http-equiv='Content-Type' content='text/html; charset=unicode' />
                    <meta http-equiv='X-UA-Compatible' content='IE=10' /> 
                    <title></title>
                </head>
                <body>
                    <div>
                         <video autoplay loop preload='metadata' >
                            <source src='http://img-9gag-ftw.9cache.com/photo/a8bR9MZ_460sv.mp4' type='video/mp4' />
                                not support
                        </video>
                    </div>
                </body>
                </html>");



如何从本地播放视频

i change src ='file:// d:/smoke.mp4'但不行。


how can i play video from local
i change src='file://d:/smoke.mp4' but not work.

推荐答案

我明白什么是本地,不明白什么是不在主机。我最近演示了一个简单的例子,其中,视频是从输出(或可执行)目录中的文件播放的:

用于在C#.Net WinForms / WPF中合成/混合视频的方法或框架 [ ^ ]。



(我几乎无法想象任何人真的需要在XAML中对任何视频文件进行硬编码;您可以将其与放置文件名的其他控件绑定,或直接获取文件来自 OpenFileDialog 的名称,但只有 Source 属性中的文件名才起作用。您的URI将作为d: /smoke.mp4,但最好不要这样做(它会使你成为一个无法复制到其他计算机上的非工作应用程序),使用相对URI。或者,如果这样是永久文件,打包嵌入资源并使用URI,使用资源URI。 :-))



-SA
I understand what is "local", don't understand what is "not in host". I recently demonstrated a simple example where, among other things, video is played from the file in the output (or executable) directory:
Methods or frameworks for compositing/blending videos in C# .Net WinForms/WPF[^].

(I hardly can imagine that anyone really need to hard-code any video file in XAML; you can bind it with some other control where the file name is put, or directly take the file name from an OpenFileDialog, but just a file name in Source attribute does work. Your URI will work as "d:/smoke.mp4", but better don't do it (it will make you a non-working application which cannot be copied to work on other computers), use relative URI. Or, if this is a permanent file, pack it embedded resource and use URI, use resource URI. :-))

—SA


这篇关于如何在webbrowser控件c#wpf中从本地(不是主机)播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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