Jump to content

How to play videos in desktop?


55143681

Recommended Posts

2 hours ago, 55143681 said:

Questions:

1.I know in the mobile ,UnimVideo can play videos,

but,How can I play videos in desktop?

 

2.UnimVideo can not play *.flv files,how to do that?

 

 

Hello, when I need to show vdeo this what I use:

TUniForm_VideoFrame = class(TUniForm)
with frame    UniHTMLFrame1: TUniHTMLFrame;

on BtnClick

var

MyStrList : TStringList;

with TUniForm_VideoFrame.Create (UniApplication) do begin
                    //ClientEvents.ExtEvents.Values['form.resize'] := 'function form.resize(sender, width, height, oldWidth, oldHeight, eOpts);'
                    //                                                + '{'
                    //                                                + '  var Velement = document.getElementById("MyVideoFrame");'
                    //                                                + '  Velement.width = ' + IntToStr (uniForm_VideoFrame.width) + ';'
                    //                                                + '  Velement.height = ' + IntToStr (uniForm_VideoFrame.height) + ';'
                    //                                                + '};'
                    //                                                ;

                    //set width
                    if TRIM (MyStrList [1]) = '' then
                        MyStrList [1] := IntToStr(UniHTMLFrame1.Width);
                    //set Height
                    if TRIM (MyStrList [2]) = '' then
                        MyStrList [2] := IntToStr(UniHTMLFrame1.Height);
                    //set defaults
                    if TRIM (MyStrList [3]) = '' then
                         MyStrList [3] := 'autoplay muted controls controlsList="nodownload"';//'autoplay muted loop controls controlsList="nodownload"'
 

                    //set file type
                    sVideoFileType := COPY (ExtractFileExt (PlaySoundFile),2,Length (ExtractFileExt (PlaySoundFile)));
                    sVideoFileType := StringReplace (sVideoFileType,'ogv','ogg',[rfReplaceAll,rfIgnoreCase]);
                    //sVideoFileType := StringReplace (sVideoFileType,'ogv','WebM',[rfReplaceAll,rfIgnoreCase]);
                    sVideoFileType := LowerCase(sVideoFileType);

                    UniHTMLFrame1.HTML.Add(' <!DOCTYPE html> '
                                       + ' <html> '
                                       + ' <body> '
                                       + '   <video id="MyVideoFrame" '
                                       + '          width="' + MyStrList [1] + '"'
                                       + '          height="' + MyStrList [2] + '"'
                                       //add params
                                       +            MyStrlist [3]
                                       + '    >'
                                       + '   <source src="' + PlaySoundFile +'"'
                                       + '           type="video/' + sVideoFileType + '"> '
                                       + '   Your browser does not support the video tag.'
                                       + '   </video> '
                                       + ' </body> '
                                       + ' </html>); 

ShowModal;

end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...