File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,23 @@ const Video = ({
211
211
>
212
212
{ video &&
213
213
video . sources &&
214
- video . sources
215
- . sort ( ( v ) => ( v . format === 'video/webm' ? - 1 : 1 ) )
214
+ video . sources
215
+ . sort ( ( a , b ) => {
216
+
217
+ if ( a . format === b . format ) return 0 ;
218
+ if ( a . format === 'video/quicktime' ) return - 1 ;
219
+ if ( b . format === 'video/quicktime' ) return 1 ;
220
+
221
+ if ( a . format === 'video/mp4' ) return - 1 ;
222
+ if ( b . format === 'video/mp4' ) return 1 ;
223
+
224
+ if ( a . format === 'video/webm' ) return - 1 ;
225
+ if ( b . format === 'video/webm' ) return 1 ;
226
+
227
+ if ( a . format === 'video/ogg' ) return - 1 ;
228
+ if ( b . format === 'video/ogg' ) return 1 ;
229
+ return 0 ;
230
+ } )
216
231
. map ( ( v ) => < source key = { v . url } src = { v . url } type = { v . format || 'video/mp4' } /> ) }
217
232
< p > { altText || 'Your browser does not support this video' } </ p >
218
233
</ video >
You can’t perform that action at this time.
0 commit comments