amplify-video icon indicating copy to clipboard operation
amplify-video copied to clipboard

React video code for both Dash and HLS?

Open prajendra-is opened this issue 3 years ago • 1 comments

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 avatar Mar 23 '22 00:03 prajendra-is

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',
    }
]}

erictallman avatar Aug 22 '22 17:08 erictallman