Avatar of hidrau
hidrau
Flag for Brazil asked on

Run video youtube webbrowse

Hello guys

I tried this in my delphi X7, but it didn't work

I want to know if it works in your delphi, maybe I am having some troble with my delphi and TwebBrowse


http://stackoverflow.com/questions/3931487/is-there-any-other-way-to-view-youtube-video-on-delphi

thanks
Alex
Delphi

Avatar of undefined
Last Comment
Ferruccio Accalai

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ferruccio Accalai

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
hidrau

ASKER
Hello Ferruccio Accalai,

thanks a lot for your reply and help.

I used your code but nothing was load in my webbrowse.

did you also use the html code that comes with that example?
Ferruccio Accalai

Yes I've tested that code and in a first try it didn't work so I've changed the html (the same of course) assignment as posted above and it worked
The test result
hidrau

ASKER
it is strange because I can run youtube site and run some video from it when I load the youtube site, but I can load the video through that code.

If I load the youtube site this way:   WebBrowser1.Navigate('www.youtube.com.br') it works :(

I am trying to understand what it could be
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Ferruccio Accalai

Try to navigate the same code from a local html page.
Give a try to this just to see if  it works this way (this example doesn't need activex)

procedure TForm1.Button2Click(Sender: TObject);
var
  ls: TSTrings;
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
    ls := tstringlist.create;
    try
      ls.text := '<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> ';
      ls.savetofile('c:\loadwb.htm');
    finally
      ls.free;
    end;
    WebBrowser1.Navigate('file://c:\loadwb.htm');
  end;
end;

Open in new window

hidrau

ASKER
I noticed that the problem must be in IE, because I ran the code in IE and it didn't work but in Chrome, it worked fine.

As webbrowse works with IE, something wrong in my IE.

at the first time, the IE asks to allow the activex and even I allow it, the page doesn't open in my IE.

The version of my IE is 11

Just to finish the issue, could you send me the exe file so that I can test it here?

thanks again
Ferruccio Accalai

Cannot upload an exe file here, but you could compile my test project attached hereWB.zip
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
hidrau

ASKER
The problem is my computer, it works with yours and mine exe in other machine.
hidrau

ASKER
thanks a lot for your help
Ferruccio Accalai

Glad to have helped you
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck