What is the best way to play a video in a desktop application

  1. 6 days ago

    VALERIY K

    Nov 7 Pre-Release Testers, Xojo Pro

    Hi, guys,

    I am creating an application in which medical students will watch a video that portrays a student taking history and performing physical exam on a simulated patient.

    After watching a video, medical students will practice documenting the encounter (writing a patient note).

    What is the best way to play video in a desktop application? I can think of the following options and all of them have their downsides.

    1. Place videos on YouTube and play them via the HTMLViewer.

    The problem with this method is that the HTMLViewer shows Youtube's sidebar. I wanted the video to cover the entire area of the HTMLViewer.

    2. Place video on DropBox and play them via the HTMLViewer.

    All works well except there are several buttons that allow users to download the video.

    3. I can package videos and refer to them as to FolderItem but it will make an application huge.

    Youtube has a function to embed video. The code to embed video is

    <iframe width="560" height="315" src="https://www.youtube.com/embed/tvlo2yp2oVs" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    

    Where in the HTMLViewer should I put this code to have the video embedded?

    Thank you in advance.

    VK

    Have you taken a look at MoviePlayer.OpenURLMovie?
    https://docs.xojo.com/index.php/OpenURLMovie

    So if you post the movie files to a server (I would assume that DropBox might work also) and then use the built-in movie player to play it.

    @VALERIYKOZMENKO Youtube has a function to embed video. The code to embed video is

    You need to wrap this in a HTML page, which you could do with a string object, then pass it to the HTMLViewer.
    https://docs.xojo.com/HTMLViewer.LoadPage

    Or you can create HTML pages on a web server and link to those from the HTMLViewer.

  2. Sam R

    Nov 7 Pre-Release Testers, Xojo Pro Answer Hengchun, Pingtung, Taiwan

    Have you taken a look at MoviePlayer.OpenURLMovie?
    https://docs.xojo.com/index.php/OpenURLMovie

    So if you post the movie files to a server (I would assume that DropBox might work also) and then use the built-in movie player to play it.

    @VALERIYKOZMENKO Youtube has a function to embed video. The code to embed video is

    You need to wrap this in a HTML page, which you could do with a string object, then pass it to the HTMLViewer.
    https://docs.xojo.com/HTMLViewer.LoadPage

    Or you can create HTML pages on a web server and link to those from the HTMLViewer.

  3. VALERIY K

    Nov 7 Pre-Release Testers, Xojo Pro

    Thank you, Sam, for the good advice.

    I will learn about this method and will post the result.

    Huge thank you, again.

    Val

  4. VALERIY K

    Nov 7 Pre-Release Testers, Xojo Pro

    Hi, Sam,

    Your suggestion worked like a charm.

    There is one detail that anyone who wants to use this method need to take into account.

    When a link to DropBox file is generated it looks like this:

    ...../Case01.mp4?dl=0"

    It needs to be changed to the following:

    ..../Case01.mp4?raw=1"

    Somebody else has taught me this trick in relation to playing movies in a web application. It looks like it is applicable to desktop applications as well.

    It would be wonderful if someone explained what exactly dl=0 vs raw=1 means.

    Otherwise, I am like a monkey who saw a trick but has no clue how it works.

    Thank you again, Sam.

    Val

or Sign Up to reply!