| 2413 | // sums the lengths of all the frames and gets the duration |
| 2414 | |
| 2415 | function checkFrames(frames) { |
| 2416 | if (!frames[0]) { |
| 2417 | postMessage({ |
| 2418 | error: 'Something went wrong. Maybe WebP format is not supported in the current browser.' |
| 2419 | }); |
| 2420 | return; |
| 2421 | } |
| 2422 | |
| 2423 | var width = frames[0].width, |
| 2424 | height = frames[0].height, |
| 2425 | duration = frames[0].duration; |
| 2426 | |
| 2427 | for (var i = 1; i < frames.length; i++) { |
| 2428 | duration += frames[i].duration; |
| 2429 | } |
| 2430 | return { |
| 2431 | duration: duration, |
| 2432 | width: width, |
| 2433 | height: height |
| 2434 | }; |
| 2435 | } |
| 2436 | |
| 2437 | function numToBuffer(num) { |
| 2438 | var parts = []; |