Skip to content

Instantly share code, notes, and snippets.

View AndrewBuntsev's full-sized avatar

Andrei Buntsev AndrewBuntsev

View GitHub Profile
$('#uploadVideoProgressBar').width(percentLoaded + "%");
<div id="uploadVideoProgressBar" style="height: 5px; width: 1%; background: #2781e9; margin-top: -5px;"></div>
function UploadVideo(file) {
var loaded = 0;
var chunkSize = 500000;
var total = file.size;
var reader = new FileReader();
var slice = file.slice(0, chunkSize);
// Reading a chunk to invoke the 'onload' event
reader.readAsBinaryString(slice);
console.log('Started uploading file "' + file.name + '"');
function UploadVideo(file) {
var loaded = 0;
var chunkSize = 500000;
var total = file.size;
var reader = new FileReader();
var slice = file.slice(0, chunkSize);
// Reading a chunk to invoke the 'onload' event
reader.readAsBinaryString(slice);
console.log('Started uploading file "' + file.name + '"');
$('#uploadVideoFile').on('change',
function() {
var fileInput = document.getElementById("uploadVideoFile");
console.log('Trying to upload the video file: %O', fileInput);
if ('files' in fileInput) {
if (fileInput.files.length === 0) {
alert("Select a file to upload");
} else {
var $source = $('#videoSource');
$source[0].src = URL.createObjectURL(this.files[0]);
div id="videoSourceWrapper">
<video style="width: 100%;" controls>
<source id="videoSource"/>
</video>
</div>
var fileInput = document.getElementById("uploadVideoFile");
<input type="file" id="uploadVideoFile" accept="video/*" />
#save-popup-icon-img{
animation-name: expand;
animation-duration: 1s;
}
@keyframes expand{
0% {transform: scale(0);}
100% {transform: scale(1);}
}
document.getElementById("save-popup-icon").innerHTML =
"<img id='save-popup-icon-img' width=120
src='https://ludu-assets.s3.amazonaws.com/lesson-icons/yWfNH8VAg7yf2SKSaRdu'/>";
document.getElementById("save-popup-title").innerHTML = "Success!";