I am using the TinyMCE rich text editor in my laravel appliaction. When I uploaded the video from the text-editor and saved into the database (which is automatically converted to the base64 format) and when I want to edit the same video at that time video is not playing in the text-editor. Here is the example
- Let’s consider I am uploading a blog post using the rich text editor (TinyMCE)
- when initally I am uploading the video from the text editor it is playing in the text-editor
- when I am going to update the same blog post then except the video every thing is loaded as expected but video source not loaded and video get blanked
Here is code which I am using on the update blog post page
`tinymce.init({
selector: ‘#mytextarea’,
plugins: ‘media’,
toolbar: ‘media’,
file_picker_types: “image media”,
media_live_embeds: true,
content_style: “body { font-family: Helvetica, Arial, sans-serif; font-size: 14px }”,
height: 400, // Set the height to your desired value
file_picker_callback: function(cb, value, meta) {
var input = document.createElement(“input”);
input.setAttribute(“type”, “file”);
if (meta.filetype == “image”) {
input.setAttribute(“accept”, “image/“);
}
if (meta.filetype == “media”) {
input.setAttribute(“accept”, “video/“);
}
input.onchange = function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function() {
var id = "blobid" + (new Date()).getTime();
var blobCache = tinymce.activeEditor.editorUpload.blobCache;
var base64 = reader.result.split(",")[1];
var blobInfo = blobCache.create(id, file, base64);
blobCache.add(blobInfo);
cb(blobInfo.blobUri(), {
title: file.name
});
};
reader.readAsDataURL(file);
};
input.click();
}
});`
uploaded video in edit mode
I just want to know what is wrong with my code!! why uploaded video perview not available in edit mode
Gurpreet Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.