cookpete / react-player

A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
https://cookpete.github.io/react-player
MIT License
9.41k stars 1.15k forks source link

Not able to use Audio Player using m3u8 file format. #1592

Closed ranveersequeira closed 1 year ago

ranveersequeira commented 1 year ago

Current Behavior

I'm using next12.1 and react18 to play audio which is coming from backend and is in m3u8 (hls) format.

Expected Behavior

It should show Audio player on page. But it's showing blank. Its only rendering

when I use m3u8 file otherwise its working fine. <ReactPlayer url={audioSrc} // url='https://www.youtube.com/watch?v=ysz5S6PUM-U' forceAudio forceHLS width='100%' height='100%' />

I have tried this also <ReactPlayer url={audioSrc} // url='https://www.youtube.com/watch?v=ysz5S6PUM-U' config={{ file: { forceAudio: true, forceHLS: true } }} width='100%' height='100%' /> I'm using like this.

Environment

cookpete commented 1 year ago

You can see a CORS error in the console. You’ll have to update the CORS settings on the s3 bucket.

image
ranveersequeira commented 1 year ago

is the syntax for the file config is right? Thanks for your time.

cookpete commented 1 year ago

Your second example is correct, although you can also do:

<ReactPlayer
    url={audioSrc}
    config={{
        forceAudio: true,
        forceHLS: true
    }}
    width='100%'
    height='100%'
/>
ranveersequeira commented 1 year ago

I dont think there is issue with CORS. Because I have played URL - https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8 Mentioned on Official Website on my local using this syntax. Its blank in browser although its showing audio element in elements tab. image