Search code examples
javascriptvideom3u8

Video file won't play using jwplayer


I'm not a professional, I'm doing a blind imitation I created and memorized the m3u8 file This is what it contains

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:3
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-ALLOW-CACHE:YES
#EXTINF:3.000,
lo-1.ts
#EXTINF:3.000,
lo-2.ts

However, when I uploaded it to the storage puller and created the link to run it on the web, it didn't work What should I add and how, for the video to work

This is my link

jsfiddle

<script type='text/javascript' src='https://content.jwplatform.com/libraries/0P4vdmeO.js'></script>
<div id="myElement"></div>

<script>
    jwplayer("myElement").setup({
      file: "https://okoshiyasu.000webhostapp.com/lo.m3u8",
    });
</script>


Solution

  • "I uploaded the .ts file to the same domain and I modified the file like #EXTINF:3.000, lo-1.ts
    But the problem remains"

    There is something wrong with your file host (maybe in settings?). Instead of giving raw file bytes, it instead gives a text version of the file bytes.

    For example, when using Chrome, try to open these links in a new tab:

    1) Your host: https://okoshiyasu.000webhostapp.com/lo-1.ts = shows text in tab (wrong result).

    2) Github test: https://vcone.github.io/public/demos/Mpeg_TS/lo-1.ts = downloads file (correct result).

    Becase the file bytes are downloaded (not written text on page) this mean the HLS player gets the data correctly and can now play the video.

    Example playback (where .ts file is served from Github):
    https://vcone.github.io/public/demos/Mpeg_TS/VC1_Demo_LO_01.html

    Solution:
    Find a way to fix these links of your .ts file(s) to auto-download to disk. When that is fixed, then the file is also now playable by HLS players. Maybe you can set file type settings if possible? Right now it acts like you uploaded a web page (or text) instead of binary data (file bytes). Maybe it is not allowed for their free space? Check with 000webhostapp.com Admins or forums.