M3U8 file support

I wish to play m3u8 video files within my post.
What methods are available for parsing video links?
I encountered an error when pasting the video link:
Sorry, we were unable to generate a preview for this web page, because the following oEmbed / OpenGraph tags could not be found: description, image

My fundamental query is about how to play streaming videos in posts and what formats are supported.

Hello,

The HTTP Live Streaming (HLS) links are not supported as onebox.

What you can do is to use the <video> HTML tag.
For example:

<video controls  preload="metadata">
  <source src="https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8" type="application/x-mpegURL" />
</video>

You can use this Insert Video component to insert the <video> tag easily.

From what I see, the HLS support is pretty limited to Android/IOS devices, with no major desktop browser except Safari.

If you want to make it work on a Desktop, you will need a third-party library, such as videojs, and a Theme component to integrate it.

1 Like

I wanna use videojs to play HLS videos.
I change discourse/lib/oneboxer.rb
add this code :

module Oneboxer
  ONEBOX_CSS_CLASS = "onebox"
  AUDIO_REGEX = /\A\.(mp3|og[ga]|opus|wav|m4[abpr]|aac|flac)\z/i
  VIDEO_REGEX = /\A\.(mov|mp4|webm|m4v|3gp|ogv|avi|mpeg|ogv)\z/i
  HLS_REGEX = /\A\.(m3u8)\z/i

 ***other code 
    when HLS_REGEX
      <<~HTML
      <script src="https://vjs.zencdn.net/8.10.0/video.min.js"></script>
      <link href="https://vjs.zencdn.net/8.10.0/video-js.css" rel="stylesheet" />
      <div class="onebox video-onebox">
        <video-js #{additional_controls} width="100%" height="100%"  class="vjs-default-skin" controls>
          <source src="#{normalized_url}">
        </video-js>
      </div>
      HTML

then I change discourse-docker project. I replace https://github.com/discourse/discourse.git
to my changed project.
I replace these files:

image/base/slim.Dockerfile
image/discourse_dev/postgres_dev.template.yml

But It not work.
If anyone can fix this feature?
I can pay for it.

You can post a topic in marketplace or even move this topic there and edit the OP a bit.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.