1

For my own personal entertainment, i have built a custom media player (more of a media library really). I have a PC hooked up to my main lounge TV so wanted something that organised all my video files and also incorporated catchup so everything is in one place.

On the most part, it's perfect. The issue I'm having is with specific file types.

I have a local link where the path leads to the folder the video files are stored on my pc so my HTML is:

<a href="file:///C:\Users\MyName\Documents\Media\videofilehere.mp4">

I use Chrome as my default browser and for .mp4 files, this opens the built in video player and plays the files - No problem there.

However some of my files are .avi and .mkv and with these, instead of playing, they start downloading (which is of course pointless given the files are already stored on my PC!)

I've done a lot of reading and the only questions on this anywhere (not just on SO) seem to the complete opposite where people WANT to force a download rather than play in the browser.

I COULD convert all files to .mp4 but thats isn't really realistic given most of these files are ripped from my blu ray collection.

Can anyone offer any tips on how I can always force any vide file to open within the browser (if this is even possible?)

EDIT: I tried the tags but that doesnt do what I need, allow me to explain further.

With video tags I had this:

<video controls width=800 autoplay>
    <source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4">
</video>

This embeds the video on the page. I don't want to do this, or in fact I may do this but for me it doesn't seem to work as my video links are picked up from a custom field and it doesn't seem to like that. What I have is a grid of covers of my DVD/blu-ray collection and the whole image links to the video. When it's an mp4 and i click it, a new tab opens in Chrome with the video. When I do it with any other file such as .avi or .mkv, it just starts downloading the file.

So my full code for this section (bare in mind this is WordPress too!) is:

<a href="file:///C:\Users\MyName\Documents\Media\videofilehere.mp4">
    <?php if ( has_post_thumbnail() ) {
        $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),'’thumbnail’' );
        echo '<img width="100%" class="fet-img" src="' . $image_src[0] . '">';
        } 
    ?>
</a>

So in effect it is simply an image that is wrapped in a link to the video.

With this in mind, is the tag what I want given I don't want to play anything within this section (just play it in a new tab when I click the video link)

jfar_2020
  • 161
  • 4
  • 23
  • Use the `HTML 5` ` – Zak May 29 '18 at 15:01
  • https://stackoverflow.com/questions/21192713/how-to-playback-mkv-video-in-web-browser?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Zak May 29 '18 at 15:02
  • Thanks a lot, I am using a local installation of WordPress which also picks up a featured image of the movie/programme cover so I need to get my head round how to incorporate that into this too! – jfar_2020 May 29 '18 at 15:21
  • Question updated with more info. – jfar_2020 May 29 '18 at 15:43

0 Answers0