awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

React video code for both Dash and HLS? #342

Open prajendra-is opened 2 years ago

prajendra-is commented 2 years ago

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):

erictallman commented 1 year ago

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