Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

React video code for both Dash and HLS? #342

Open
prajendra-is opened this issue Mar 23, 2022 · 1 comment
Open

React video code for both Dash and HLS? #342

prajendra-is opened this issue Mar 23, 2022 · 1 comment

Comments

@prajendra-is
Copy link

prajendra-is commented Mar 23, 2022

Describe the bug
When I added the video plugin for my amplify app, I picked both HLS and Dash. When I use the code provided by amplify video setup-video-player:

<VideoPlayer 
    autoplay
    controls
    sources={[{
      src: 'https://<abc>.cloudfront.net/{path}/{path.m3u8}',
      type: 'application/x-mpegURL'
    }]}
/>

I'm able to play Dash using:

      sources={[{
        src: 'https://<>.cloudfront.net/<path>/dash/<path>.mpd',
        type: 'application/dash+xml',
      }]}

Or HLS using:

      sources={[{
        src: 'https://<>.cloudfront.net/<path>/hls/<path>.m3u8',
        type: 'application/x-mpegURL',
      }]}

These both work individually, but what code is needed so that it prefers one (say Dash), and fallsback to HLS instead?

Desktop (please complete the following information):

  • OS: [macOS 11.6.4]
  • Browser [Chrome]
  • Version [Version 99.0.4844.83 (Official Build) (arm64)
@prajendra-is prajendra-is changed the title sample VideoPlayer code not working: VIDEOJS: WARN: Problem encountered with playlist 0 sample VideoPlayer code works for DASH (.m3u8), but not for HLS video Mar 23, 2022
@prajendra-is prajendra-is changed the title sample VideoPlayer code works for DASH (.m3u8), but not for HLS video Video code for both Dash and HLS? Mar 23, 2022
@prajendra-is prajendra-is changed the title Video code for both Dash and HLS? React video code for both Dash and HLS? Mar 23, 2022
@erictallman
Copy link

Have you tried this?

sources={[
    {
        src: 'https://<>.cloudfront.net/<path>/dash/<path>.mpd',
        type: 'application/dash+xml',
    },
    {
        src: 'https://<>.cloudfront.net/<path>/hls/<path>.m3u8',
        type: 'application/x-mpegURL',
    }
]}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants