VB.NET 形式的嵌入视频 - 从 URL 在线和文件引用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15903504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Embedded videos in VB.NET form - referenced from URL online and file
提问by Rasa Rin
I am trying to implement a video player on VB.NET form that would play videos from both online URL (it could be from Youtube or any other URL that points to the video) or file location. I tried to add Windows Media Player and play videos from the file, which works fine, but I can't play videos let's say from Youtube. I did some research and some of the articles suggested that Shockwave Flash Object control would play videos from online, but that would be two different controls on one form virtually doing the same thing.
我正在尝试在 VB.NET 表单上实现一个视频播放器,它可以从在线 URL(它可能来自 Youtube 或任何其他指向视频的 URL)或文件位置播放视频。我尝试添加 Windows Media Player 并播放文件中的视频,效果很好,但我无法播放视频,比如说来自 Youtube。我做了一些研究,有些文章表明 Shockwave Flash Object 控件可以播放来自在线的视频,但这实际上是一种形式上的两种不同控件在做同样的事情。
I wanted to ask if there is a control to display videos that would handle both references - online URL and file location?
我想问一下是否有一个控件来显示可以处理两个引用 - 在线 URL 和文件位置的视频?
采纳答案by Sam
In short, the Windows Media Playercontrol will only play a video if the given URL actually points to a video file, for example,
简而言之,Windows Media Player如果给定的 URL 实际指向一个视频文件,则控件只会播放视频,例如,
http://www.example.com/files/videos/MyVid.mp4
http://www.example.com/files/videos/MyVid.mp4
C:\Users\John\Videos\MyVid.mp4.
C:\Users\John\Videos\MyVid.mp4.
You cannot directlyplay videos from YouTube, because Google do notdisplay the direct URL of videos from YouTube, so you have to generate a URL to get to the video you want to stream (although I'm not entirely sure if that's legal).
您不能直接播放来自 YouTube 的视频,因为 Google不显示来自 YouTube 的视频的直接 URL,因此您必须生成一个 URL 才能访问您想要流式传输的视频(尽管我不完全确定这是否合法)。
回答by N-ninja
i have found that using shockwave flash and on the youtube video link, adding a /v just before the /watch, will allow you to stream the video. (you add the link on the movie properties of the flash module) I don't think you can play videos from your directory though, which i have been trying to find for ours how to do)
我发现使用shockwave flash 并在youtube 视频链接上,在/watch 之前添加一个/v,将允许您流式传输视频。(您在 flash 模块的电影属性上添加链接)不过,我认为您无法播放目录中的视频,我一直在为我们的方法寻找如何做)

