juancabrera/react-asset-loader

Make it smart so it will create just one video element with different sources instead of multiple video elements

Opened this issue · 2 comments

Make it smart so it will create just one video element with different sources instead of multiple video elements

How do you want to specify that there are different sources of the same video? What about their types?

What do you think about something like this?

var myAssets = [
  {
    type: "video",
    assets: [
      {uri: "/static/videos/video1.mp4", type: "video/mp4; codecs=avc1.42E01E,mp4a.40.2"},
      {uri: "/static/videos/video1.webm", type: "video/webm; codecs=vp8,vorbis"}
    ]
  }
];
<LoadAssets assets={myAssets} />

Right now the "cool think" of asset loader is that you don't need to pass any type (like your type:"video"), it's detecting it. So I won't add the type.

I thought that maybe if there are 2 videos with different formats with the same name assume it's a video with two sources. Not sure if it's the best solution though, I feel that to do this it will add lot of code, and want to keep it small..