Copy link to clipboard
Copied
Hi, I'm trying to create project with a video by using blob type. I used createWithAsset () method with bellow configuration but the edtior show an error message and then close. So if anyone know what I did wrong please let me know, any helps would be really appericated.
...
// data dataUrl is a url to the mp4 file
// fetch the file
const fetchedVideo = await fetch(dataUrl);
// covert to blob
const videoBlob = await fetchedVideo.blob();
//open and upload to adobe embeded with below config
ccEverywhere.editor.createWithAsset(
{
canvasSize: 'Video',
asset: {
type: 'video',
dataType: 'blob',
data: videoBlob,
},
},
{
selectedCategory: 'media',
allowedFileTypes: ['image/png', 'image/jpeg', 'video/mp4'],
callbacks: {
onPublish: (intent, publishParams) => {
//...
},
},
},
[
{
id: 'export-btn',
label: 'Save & Export',
action: {
target: 'publish',
},
style: {
uiType: 'button',
},
},
],
{
zIndex: 1,
}
);
Other error logs from my browser console:
Hi,
there's one more step involved: fetch -> blob -> file, then it works:
const video = await fetch(
"https://videos.pexels.com/video-files/8468212/8468212-hd_1080_1920_30fps.mp4"
)
.then((res) => res.blob())
.then((blob) => new File([blob], "My video File", { type: "video/mp4" }));
let docConfig = {
canvasSize: "YoutubeVideo",
asset: {
data: video,
dataType: "blob",
type: "video",
},
};
editor.createWithAsset(docConfig, {}, []);
I hope this helps! And thank you so m