[Demo] How to insert YouTube video in the editor
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
[Demo] How to insert YouTube video in the editor
This demo shows how to insert a YouTube video in a Delphi application using TRichViewEdit:
The user enters the video URL (in the form http://www.youtube.com/watch?v=VIDEOID). The program creates TShockWaveFlash control and assign its Movie property to play the specified video.
Update: Unfortunately, the result now looks like this: But when exported in HTML and viewed in a browser, it looks correctly.
This demo uses "Shockwave Flash" ActiveX (as TShockWaveFlash component).The user enters the video URL (in the form http://www.youtube.com/watch?v=VIDEOID). The program creates TShockWaveFlash control and assign its Movie property to play the specified video.
Update: Unfortunately, the result now looks like this: But when exported in HTML and viewed in a browser, it looks correctly.
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Use OnSaveComponentToFile event:
Code: Select all
procedure TForm1.RichViewEdit1SaveComponentToFile(Sender: TCustomRichView;
Path: String; SaveMe: TPersistent; SaveFormat: TRVSaveFormat;
var OutStr: String);
begin
if (SaveFormat=rvsfHTML) and (SaveMe is TShockwaveFlash) then begin
OutStr := Format(
'<object width="%d" height="%d">'+
'<param name="movie" value="%s"></param>'+
'<param name="allowFullScreen" value="true"></param>'+
'<param name="allowscriptaccess" value="always"></param>'+
'<embed src="%s" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="%d" height="%d"></embed>'+
'</object>',
[TShockwaveFlash(SaveMe).Width, TShockwaveFlash(SaveMe).Height,
TShockwaveFlash(SaveMe).Movie,
TShockwaveFlash(SaveMe).Movie,
TShockwaveFlash(SaveMe).Width, TShockwaveFlash(SaveMe).Height]);
end;
end;
@Sergey Tkachenko
Wow...your code above work properly.
Now, I have a problem.
When I sent it via email and I open it with Microsoft OutLook, I can not see
the youtube. What I have to do in order to see the video from email.
Actually, I want to send mass email to my friends and they can see the
video when open the email.
Do you think that this issue is possible to be done by TRichView?
Wow...your code above work properly.
Now, I have a problem.
When I sent it via email and I open it with Microsoft OutLook, I can not see
the youtube. What I have to do in order to see the video from email.
Actually, I want to send mass email to my friends and they can see the
video when open the email.
Do you think that this issue is possible to be done by TRichView?
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
@Sergey Tkachenko
Thanks for your explanation. You're right, MS OutLook does not support for
showing the youtube video directly. It seems that I have to create it by
myself, so I do not need to use Microsoft Outlook anymore.
Any way, your code above has provided me a hint so useful to achieve this
issue.
regards,
Eko Indriyawan
Thanks for your explanation. You're right, MS OutLook does not support for
showing the youtube video directly. It seems that I have to create it by
myself, so I do not need to use Microsoft Outlook anymore.
Any way, your code above has provided me a hint so useful to achieve this
issue.
regards,
Eko Indriyawan
Just tried this demo on Delphi 2010 under Windows 7 x64 with Adobe Flash 10.2 installed.
It works but during insert I'm getting some EInvalidOp with message 'Invalid floating point operation' errors and Access violation at address 608C89B1 in module 'Flash10o.ocx'. Write of address 0000566D.
Didn't check the code yet just wanted to inform about these errors.
It works but during insert I'm getting some EInvalidOp with message 'Invalid floating point operation' errors and Access violation at address 608C89B1 in module 'Flash10o.ocx'. Write of address 0000566D.
Didn't check the code yet just wanted to inform about these errors.
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Try to click several times... I just tried again and got (from 3-4th click):
AND
Code: Select all
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EInvalidOp with message 'Invalid floating point operation'.
---------------------------
Break Continue Help
---------------------------
Code: Select all
---------------------------
Project
---------------------------
Access violation at address 5DE389B1 in module 'Flash10o.ocx'. Write of address 0000566D.
---------------------------
OK
---------------------------
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: