Search code examples
javascriptandroidfirefoxfirefox-android

How to create thumbnail for video on Firefox for Android


I am looking for a method to generate thumbnail in Firefox for Android. I found some resources regarding this topic: Create thumbnail from video file via file input. But Firefox for Android always throws NS_ERROR_NOT_AVAILABLE when calling drawImage(HTMLVideoElement, int, int, int, int).

The example attached in the SO post can be used to reproduce this issue: https://codepen.io/aertmann/pen/mAVaPx. The example throws on Firefox for Android while it works on Mac and iOS (afaik it is a downgraded version of Safari). According to https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage, NS_ERROR_NOT_AVAILABLE is thrown when resource is not loaded. However, even when I try to do it after loadedmetadata and loadeddata or follow another similar question on SO (Firefox: drawImage(video) fails with NS_ERROR_NOT_AVAILABLE: Component is not available) to retry until success, it still doesn’t work.


Solution

  • Opened an issue on Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1526207 Most probably firefox issue