Procedure YouTube( VideoCode: String; WebBrowser : TWebBrowser; AutoPlay:Boolean );
var
strIcerik : String;
sStream : TStringStream;
begin
WebBrowser.Navigate('about:blank');
while WebBrowser.ReadyState < READYSTATE_INTERACTIVE do
Application.ProcessMessages;
strIcerik := ''
+ '<html><body>'
+ '<iframe width="854" height="510" src="https://www.youtube.com/embed/%EMBED%" frameborder="0" allowfullscreen></iframe>'
+ '</body></html> ';
strIcerik := StringReplace(strIcerik, '%EMBED%', VideoCode, [rfReplaceAll]);
if Assigned(WebBrowser.Document) then
begin
sStream := TStringStream.Create;
try
sStream.WriteString(strIcerik);
sStream.Position := 0;
// NOT: uses'a ActiveX eklenecek... IPersistStreamInit için...
(WebBrowser.Document as IPersistStreamInit).Load(TStreamAdapter.Create(sStream));
finally
sStream.Free;
end;
end;
end;
Merhaba delphi 10 berlinde çalışıyorum ve yukarıdaki function çalışmıyor. webbrowser.document ve readystate sorun çıkarıyor. Öyle bir özellik olmadığı görünüyor
Delphi 10.1 Update 1 kullanarak aşağıdaki kod ile bir sorun yaşamadan çalıştırabildim. Konu ile ilgili Embed URL kısmında hatanız olmuş olabilir. Zira ben URL kısmını değiştirdim. Daha detaylı bilgi için aşağıdaki linki incelemenizi tavsiye ederim. https://developers.google.com/youtube/player_parameters