Reputation: 1280
I'm trying to create a thumbnail from from video on a remove server using the video editor plugin, but just cant get it to work. The thumbnail doesnt get created. Below is my code:
private createThumbnail(remoteFileUrl: string) {
this.thumbnailOptions = {
atTime: 60,
height: 1024,
width: 1024,
quality: 100,
fileUrl: remoteFileUrl, // looks something like this : http://example.com/filename.mp4
outputFileName: remoteFileUrl.substring(videoFile.lastIndexOf('/') + 1)
};
this.videoEditor.createThumbnail(this.thumbnailOptions).then(
thumbnail => { this.thumbnail = thumbnail; },
error => { this.thumbnail = '' }
);
}
When i run this code i get the following error
"java.io.FileNotFoundException: file:/http://example.com slash file name -> http://example.com slash file name
Upvotes: 2
Views: 1384
Reputation: 7507
Thats because the plugin does only support local video sources and you are trying to load one via the http protocol. Looking at the sourecode of the plugin you can find the following snippet in the createThumbnail()
method:
String fileUri = options.getString("fileUri");
if (!fileUri.startsWith("file:/")) {
fileUri = "file:/" + fileUri;
}
}
So if you pass a URI starting with http like in your example it will add file:/
before it - of course - resulting in a FileNotFoundException
.
You can try to fork the plugin and modify it according to your needs.
Upvotes: 1