File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -1335,15 +1335,6 @@ function media(p5, fn){
1335
1335
elt . appendChild ( sourceEl ) ;
1336
1336
}
1337
1337
1338
- // If callback is provided, attach to element
1339
- if ( typeof callback === 'function' ) {
1340
- const callbackHandler = ( ) => {
1341
- callback ( ) ;
1342
- elt . removeEventListener ( 'canplaythrough' , callbackHandler ) ;
1343
- } ;
1344
- elt . addEventListener ( 'canplaythrough' , callbackHandler ) ;
1345
- }
1346
-
1347
1338
const mediaEl = addElement ( elt , pInst , true ) ;
1348
1339
mediaEl . loadedmetadata = false ;
1349
1340
@@ -1362,6 +1353,15 @@ function media(p5, fn){
1362
1353
mediaEl . loadedmetadata = true ;
1363
1354
} ) ;
1364
1355
1356
+ // If callback is provided, attach to element
1357
+ if ( typeof callback === 'function' ) {
1358
+ const callbackHandler = ( ) => {
1359
+ callback ( mediaEl ) ;
1360
+ elt . removeEventListener ( 'canplaythrough' , callbackHandler ) ;
1361
+ } ;
1362
+ elt . addEventListener ( 'canplaythrough' , callbackHandler ) ;
1363
+ }
1364
+
1365
1365
return mediaEl ;
1366
1366
}
1367
1367
You can’t perform that action at this time.
0 commit comments