Skip to content

Commit

Permalink
PRJ-55 - Add Video thumbnail in uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
amincdev committed Jan 27, 2025
1 parent b7299d2 commit b64be91
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,20 @@ window.bp = window.bp || {};
if ( file[mediaType + '_edit_data'] ) {
view[modelKey].push( file[mediaType + '_edit_data'] );
view.model.set( modelKey, view[modelKey] );
}
}

if( 'video' === mediaType ) {
if ( file.dataURL && file.video_edit_data.thumb.length ) {
// Get Thumbnail image from response.
$( file.previewElement ).find( '.dz-image' ).prepend( '<img src=" ' + file.video_edit_data.thumb + ' " alt=""/>' );
$( file.previewElement ).closest( '.dz-preview' ).addClass( 'dz-has-thumbnail' );
} else {
if ( bp.Nouveau.getVideoThumb ) {
bp.Nouveau.getVideoThumb( file, '.dz-image' );
}

}
}
});

dropzone.on( 'uploadprogress', function( element ) {
Expand All @@ -438,6 +451,7 @@ window.bp = window.bp || {};

circle.style.strokeDasharray = circumference + ' ' + circumference;
circle.style.strokeDashoffset = circumference - (element.upload.progress.toFixed(0) / 100 * circumference);
$( element.previewElement ).find( '.dz-progress [data-dz-progress]' ).text( element.upload.progress.toFixed(0) + '%' );
});

dropzone.on('sending', function( file, xhr, formData ) {
Expand Down

0 comments on commit b64be91

Please sign in to comment.