Quantcast
Channel: Kaltura - Latest topics
Viewing all articles
Browse latest Browse all 2994

Media not uploading using JQuery

$
0
0

We are using JQuery to upload file from Client to Kaltura. Although Entry gets created, and metadata gets added to the entry but File stays in “Uploading” status.

Below is the code that we are using to upload file (taken from the JQuery plugin)

var widget = $('#uploadHook').fileupload({
                // continue to pass this, even not used, to trigger chunk upload
                maxChunkSize: 3000000,
                dynamicChunkSizeInitialChunkSize: 1000000,
                dynamicChunkSizeThreshold: 50000000,
                dynamixChunkSizeMaxTime: 30,
                host: "http://www.kaltura.com",
                apiURL:"http://www.kaltura.com/api_v3/",
                url: "http://www.kaltura.com/api_v3/?service=uploadToken&action=upload&format=1",
                ks: '${kalturaSession}',
                fileTypes: '*.mts;*.MTS;*.qt;*.mov;*.mpg;*.avi;*.mp3;*.m4a;*.wav;*.mp4;*.wma;*.vob;*.flv;*.f4v;*.asf;*.qt;*.mov;*.mpeg;*.avi;*.wmv;*.m4v;*.3gp;.QT;*.MOV;*.MPG;*.AVI;*.MP3;*.M4A;*.WAV;*.MP4;*.WMA;*.VOB;*.FLV;*.F4V;*.ASF;*.QT;*.MOV;*.MPEG;*.AVI;*.WMV;*.M4V;*.3GP;*.MKV;*.AIFF;*.arf;*.ARF;*.webm;*.WEBM;*.rm;*.RM;*.ra;*.RA;*.RV;*.rv;*.aiff;*.ogg;*.oga*.OGA',
                context: '',
                categoryId: ${categoryId},
                messages: {
                    acceptFileTypes: 'File type not allowed',
                    maxFileSize: 'File is too large',
                    minFileSize: 'File is too small'
                },
                android: "",
                singleUpload: true,
                autoUpload: true
            })
            // file added
            .bind('fileuploadadd',function(e, data){
            	
            	console.log('fileuploaded');
            	
                var uploadBoxId = widget.fileupload('getUploadBoxId',e,data);
               
                data.uploadBoxId = uploadBoxId;
                var uploadManager = widget.fileupload("getUploadManager");
                file = data.files[0];
                if(!$('#mediaName').val()){
                    $('#mediaName').val(file.name);
                }
                $("#windowCloseMessage").removeClass('hidden');
                $("#fileinput").addClass('hidden');
            })
            //actual upload start
            .bind('fileuploadsend',function(e, data){
            	console.log('fileuploadsend');
                var uploadBoxId = widget.fileupload('getUploadBoxId',e,data);
                var file = data.files[0];
                             
                var uploadManager = widget.fileupload("getUploadManager");
                
                if(file.error === undefined){
                    var context = widget.fileupload('option', 'context');
                    console.log('upload context: ' + context);
                    //here we should display an edit entry form to allow the user to add/save metadata to the entry
                    $("#uploadbox" + uploadBoxId + " .entry_details").removeClass('hidden');
                } else {
                    console.log('some kind of error when starting to upload ' + file.error);
                }
            })
            // upload done
            .bind('fileuploaddone', function(e, data){
            	console.log('fileuploaddone');
                $('#uploadTokenID').val(data.uploadTokenId);
                //Make call to backend to add media content
                addMediaContent();
            })

Will appreciate your time and feedback on this problem.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2994

Trending Articles