gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 18:12:13 25 4
gpt4 key购买 nike

我看到 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>

最佳答案

我测试了你的 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;

关于delphi - 还有其他方法可以在 delphi 上观看 youtube 视频吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3931487/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com