Delete Videos From Kaltura

Posted By : Vipul Pandey | 30-Sep-2016

Delete videos from Kaltura

To delete a video to kaltura we need  to initialize session with our credentials

1) require kaltura to our project

var kaltura = require('kaltura'); 

2) get kaltura configuration with our Kaltura partner ID

var kalturaConfig = new kaltura.kc.KalturaConfiguration(kalturaPartnerId); 

3) create an object of kaltura with the your configurations

kalturaClient = new kaltura.kc.KalturaClient(kalturaConfig);

4) starting our sesssion and

kalturaClient.session.start(function (session) {
if (session.code && session.message) {
    console.log('Error starting session of kaltura. Please check your credentials', session);
  } else {
     // operation to perform
  }

finally add delete the video to kaltura.
   to delete a video to kaltura we are using the following steps:
     1) deleteAction:  should be called to delete the video from Kaltura VPaaS

Eg.

var kalturaClient = null;
var Session = null;
var EXPIRATION_TIME = '10000000';
var kalturaPartnerId = 100;
var kalturaAdminSecret = "********************"; // this can be found in kaltura publisher console
var kalturaUserId = "[email protected]"; // this can be found in kaltura publisher console
var config = new kaltura.kc.KalturaConfiguration(kalturaPartnerId);
config.serviceUrl = kalturaServiceURL;

var videoObj = res; // response after upload the video to local
kalturaClient = new kaltura.kc.KalturaClient(config);
kalturaClient.session.start(function (session) {
        if (session.code && session.message) {
            console.log('Error starting session of kaltura. Please check  your credentials', session);
        } else {
            kalturaClient.setKs(session);

               kalturaClient.media.deleteAction(function (deleteSuccess) {
                   if (deleteSuccess && deleteSuccess.code && deleteSuccess.message) {
                      console.log("Video Remove Error")
                  } else {
                        console.log("Video Removed Success")
                }
            },
            mediaEntryId);
           
    }, kalturaAdminSecret, kalturaUserId, kaltura.kc.enums.KalturaSessionType.ADMIN,
    kalturaPartnerId, EXPIRATION_TIME);




THANKS

About Author

Author Image
Vipul Pandey

Vipul Pandey is a good team-player & developing application on MEAN and java spring boot. Vipul loves to keep rotating fingers in his keyboard until he creates somethings inspiring.Hobbies are playing cricket ,swimming & photography.

Request for Proposal

Name is required

Comment is required

Sending message..