?
Solved

Run video youtube webbrowse

Posted on 2016-09-11
10
Medium Priority
?
118 Views
Last Modified: 2016-09-12
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
0
Comment
Question by:hidrau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 2000 total points
ID: 41794247
That code doesn't work also on my Delphi 2010
but after a little change in code it worked so try this and see if it works in your delphi xe7

procedure TForm1.LoadHtml(HTMLStr: String);
var
  aStream: TMemoryStream;
  doc: variant;
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
    doc := WebBrowser1.Document;
    doc.clear;
    doc.write(HTMLStr);
    doc.close;
  end;
end;

Open in new window

0
 
LVL 1

Author Comment

by:hidrau
ID: 41794290
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?
0
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41794295
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
1
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:hidrau
ID: 41794316
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
0
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41794356
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

1
 
LVL 1

Author Comment

by:hidrau
ID: 41794483
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
0
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41794531
Cannot upload an exe file here, but you could compile my test project attached hereWB.zip
0
 
LVL 1

Author Comment

by:hidrau
ID: 41794552
The problem is my computer, it works with yours and mine exe in other machine.
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 41794554
thanks a lot for your help
0
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41794566
Glad to have helped you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question