• Resolved WPOso

    (@wordpress-oso)


    NOTE: It looks like I may have posted this in haste; it’s apparently a browser problem. The video works fine when I view my page in Chrome, but it doesn’t work with the browser Vivaldi.

    * * * * *

    I would like to insert a video that’s located @ /images/video.mp4. The following HTML5 code doesn’t work:

    <video id="sampleMovie" src="/images/video.mp4" controls></video>

    I tried another scheme without success as well. I’ve found a lot of references that offer advice on inserting videos from other sites (YouTube, etc.). But I’m confused about how you allow visitors to access a video that’s stored on your site.

    What’s the best way to accomplish this?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    (@macmanx)

    Use the full URL of the file for src.

    So, assuming the site is example.com and /images/ is under the web root, that will be:

    src="https://example.com/images/video.mp4"

    The problem is, you have provided a relative URL, which means it’s relative to the URL loaded in the browser.

    So, with a relative URL, if I’m viewing the post at example.com the browser will think the video is at example.com/images/video.mp4

    But, if I’m viewing the post at example.com/page/2/ the browser will think the video is at example.com/page/2/images/video.mp4

    Or, if I’m viewing the post at example.com/2016/06/05/this-post/ the browser will think the video is at example.com/2016/06/05/this-post/images/video.mp4

    To avoid this, always use an absolute URL, the full URL to exactly where the file is. Or, better yet, just upload and insert the video via the Add Media button when writing/editing the post/page in question.

    Thread Starter WPOso

    (@wordpress-oso)

    Thanks.

    Moderator James Huff

    (@macmanx)

    You’re welcome!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Inserting a LOCAL Video’ is closed to new replies.