有没有其他方法可以在delphi上观看youtube视频?

发布于 2024-09-27 13:52:19 字数 1094 浏览 3 评论 0原文

我看到 http://www.delphiflash.com/demo-youtube-video如何在delphi上加载flash视频,但它不是免费的。还有其他办法吗?

像 html 那么 TWebBroeser 吗?

SampleVideo.html //这在 TwebBrowser 上不起作用还有其他方法吗?

<html>
<head>
</style> 
    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style> 
</head>
<body>
  <object width="640" height="390">
  <param name="movie" value="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3">
  </param><param name="allowFullScreen" value="true">
  </param><param name="allowScriptAccess" value="always">
  </param><embed src="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390">
  </embed></object>
</body>
</html>

i see the http://www.delphiflash.com/demo-youtube-video on how to load flash video on delphi but its not for free. is there any other way?

like html then TWebBroeser?

sampleVideo.html //this will not work on TwebBrowser is there any other way?

<html>
<head>
</style> 
    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style> 
</head>
<body>
  <object width="640" height="390">
  <param name="movie" value="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3">
  </param><param name="allowFullScreen" value="true">
  </param><param name="allowScriptAccess" value="always">
  </param><embed src="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390">
  </embed></object>
</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬﹪忆之殇 2024-10-04 13:52:19

我测试了你的html代码并且在 TWebBrowser

尝试这个示例代码,在 Delphi 7 和 Delphi 2007 中测试

uses
ActiveX;

procedure TForm1.Button1Click(Sender: TObject);
begin
   LoadHtml(
            '<html> '+
            '<head> '+
            '</style> '+
            '    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>'+
            '</head> '+
            '<body>  '+
            '  <object width="640" height="390"> '+
            '  <param name="movie" value="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3"> '+
            '  </param><param name="allowFullScreen" value="true"> '+
            '  </param><param name="allowScriptAccess" value="always"> '+
            '  </param><embed src="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"> '+
            '  </embed></object> '+
            '</body> '+
            '</html> '
            );
end;


procedure TForm1.LoadHtml(HTMLStr: String);
var
  aStream     : TMemoryStream;
begin
   WebBrowser1.Navigate('about:blank');//reset the webbrowser
   while WebBrowser1.ReadyState < READYSTATE_INTERACTIVE do //wait to load the empty page
   Application.ProcessMessages;

    if Assigned(WebBrowser1.Document) then
    begin
      aStream := TMemoryStream.Create;
      try
         aStream.WriteBuffer(Pointer(HTMLStr)^, Length(HTMLStr));
         aStream.Seek(0, soFromBeginning);
         (WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(aStream));
      finally
         aStream.Free;
      end;
    end;
end;

i tested your html code and works ok in a TWebBrowser

try this sample code, tested in Delphi 7 and Delphi 2007

uses
ActiveX;

procedure TForm1.Button1Click(Sender: TObject);
begin
   LoadHtml(
            '<html> '+
            '<head> '+
            '</style> '+
            '    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>'+
            '</head> '+
            '<body>  '+
            '  <object width="640" height="390"> '+
            '  <param name="movie" value="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3"> '+
            '  </param><param name="allowFullScreen" value="true"> '+
            '  </param><param name="allowScriptAccess" value="always"> '+
            '  </param><embed src="http://www.youtube.com/v/L7NWdxFAHdY&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"> '+
            '  </embed></object> '+
            '</body> '+
            '</html> '
            );
end;


procedure TForm1.LoadHtml(HTMLStr: String);
var
  aStream     : TMemoryStream;
begin
   WebBrowser1.Navigate('about:blank');//reset the webbrowser
   while WebBrowser1.ReadyState < READYSTATE_INTERACTIVE do //wait to load the empty page
   Application.ProcessMessages;

    if Assigned(WebBrowser1.Document) then
    begin
      aStream := TMemoryStream.Create;
      try
         aStream.WriteBuffer(Pointer(HTMLStr)^, Length(HTMLStr));
         aStream.Seek(0, soFromBeginning);
         (WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(aStream));
      finally
         aStream.Free;
      end;
    end;
end;
鲸落 2024-10-04 13:52:19

这绝对有效。我在我的应用程序(ClipMate)中尝试过它,这是一个用 Delphi2007 编写的剪贴板应用程序。它可以使用 TWebBrowser 将任何文本剪辑显示为 HTML。我复制了您的示例 HTML,在 ClipMate 中将其视为 HTML,然后代理预告片立即启动。这是 - 在 Delphi 应用程序中的 TWebBrowser 中的 HTML 渲染。相同的代码在 D5、D7、D2007 中有效,并且我确认它在 D2009、D2010 中也有效。
请参阅:http://www.thornsoft.com/images/support/YoutubeClipMate.png< /a>替代文本

This definitely works. I tried it in my app (ClipMate) which is a clipboard app written in Delphi2007. It can show any text clip as HTML by using a TWebBrowser. I copied your sample HTML, viewed it as HTML within ClipMate, and the surrogates trailer fired right up. Here is is - your HTML rendering in a TWebBrowser, in a Delphi app. This same code worked in D5, D7, D2007, and I confirm that it works in D2009, D2010.
See: http://www.thornsoft.com/images/support/YoutubeClipMate.pngalt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文