Class: Kaltura::KalturaMediaService

Inherits:
KalturaServiceBase show all
Defined in:
lib/kaltura_client.rb

Overview

Media service lets you upload and manage media files (images / videos & audio)

Instance Attribute Summary

Attributes inherited from KalturaServiceBase

#client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ KalturaMediaService

Returns a new instance of KalturaMediaService.



13486
13487
13488
# File 'lib/kaltura_client.rb', line 13486

def initialize(client)
	super(client)
end

Instance Method Details

#add(entry) ⇒ Object

Add entry



13492
13493
13494
13495
13496
13497
13498
13499
13500
# File 'lib/kaltura_client.rb', line 13492

def add(entry)
	kparams = {}
	client.add_param(kparams, 'entry', entry);
	client.queue_service_action_call('media', 'add', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_content(entry_id, resource = KalturaNotImplemented) ⇒ Object

Add content to media entry which is not yet associated with content (therefore is in status NO_CONTENT).

If the requirement is to replace the entry's associated content, use action updateContent.


13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
# File 'lib/kaltura_client.rb', line 13505

def add_content(entry_id, resource=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id);
	client.add_param(kparams, 'resource', resource);
	client.queue_service_action_call('media', 'addContent', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_entry(source_entry_id, media_entry = KalturaNotImplemented, source_flavor_params_id = KalturaNotImplemented) ⇒ Object

Copy entry into new entry



13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
# File 'lib/kaltura_client.rb', line 13580

def add_from_entry(source_entry_id, media_entry=KalturaNotImplemented, source_flavor_params_id=KalturaNotImplemented)
	kparams = {}
	# Media entry id to copy from
	client.add_param(kparams, 'sourceEntryId', source_entry_id);
	# Media entry metadata
	client.add_param(kparams, 'mediaEntry', media_entry);
	# The flavor to be used as the new entry source, source flavor will be used if not specified
	client.add_param(kparams, 'sourceFlavorParamsId', source_flavor_params_id);
	client.queue_service_action_call('media', 'addFromEntry', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_flavor_asset(source_flavor_asset_id, media_entry = KalturaNotImplemented) ⇒ Object

Copy flavor asset into new entry



13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
# File 'lib/kaltura_client.rb', line 13597

def add_from_flavor_asset(source_flavor_asset_id, media_entry=KalturaNotImplemented)
	kparams = {}
	# Flavor asset id to be used as the new entry source
	client.add_param(kparams, 'sourceFlavorAssetId', source_flavor_asset_id);
	# Media entry metadata
	client.add_param(kparams, 'mediaEntry', media_entry);
	client.queue_service_action_call('media', 'addFromFlavorAsset', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_recorded_webcam(media_entry, webcam_token_id) ⇒ Object

Add new entry after the file was recored on the server and the token id exists



13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
# File 'lib/kaltura_client.rb', line 13565

def add_from_recorded_webcam(media_entry, webcam_token_id)
	kparams = {}
	# Media entry metadata
	client.add_param(kparams, 'mediaEntry', media_entry);
	# Token id for the recored webcam file
	client.add_param(kparams, 'webcamTokenId', webcam_token_id);
	client.queue_service_action_call('media', 'addFromRecordedWebcam', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_search_result(media_entry = KalturaNotImplemented, search_result = KalturaNotImplemented) ⇒ Object

Adds new media entry by importing the media file from a search provider. This action should be used with the search service result.



13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
# File 'lib/kaltura_client.rb', line 13535

def add_from_search_result(media_entry=KalturaNotImplemented, search_result=KalturaNotImplemented)
	kparams = {}
	# Media entry metadata
	client.add_param(kparams, 'mediaEntry', media_entry);
	# Result object from search service
	client.add_param(kparams, 'searchResult', search_result);
	client.queue_service_action_call('media', 'addFromSearchResult', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_uploaded_file(media_entry, upload_token_id) ⇒ Object

Add new entry after the specific media file was uploaded and the upload token id exists



13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
# File 'lib/kaltura_client.rb', line 13550

def add_from_uploaded_file(media_entry, upload_token_id)
	kparams = {}
	# Media entry metadata
	client.add_param(kparams, 'mediaEntry', media_entry);
	# Upload token id
	client.add_param(kparams, 'uploadTokenId', upload_token_id);
	client.queue_service_action_call('media', 'addFromUploadedFile', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#add_from_url(media_entry, url) ⇒ Object

Adds new media entry by importing an HTTP or FTP URL. The entry will be queued for import and then for conversion.



13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
# File 'lib/kaltura_client.rb', line 13519

def add_from_url(media_entry, url)
	kparams = {}
	# Media entry metadata
	client.add_param(kparams, 'mediaEntry', media_entry);
	# An HTTP or FTP URL
	client.add_param(kparams, 'url', url);
	client.queue_service_action_call('media', 'addFromUrl', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#anonymous_rank(entry_id, rank) ⇒ Object

Anonymously rank a media entry, no validation is done on duplicate rankings



13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
# File 'lib/kaltura_client.rb', line 13907

def anonymous_rank(entry_id, rank)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id);
	client.add_param(kparams, 'rank', rank);
	client.queue_service_action_call('media', 'anonymousRank', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#approve(entry_id) ⇒ Object

Approve the media entry and mark the pending flags (if any) as moderated (this will make the entry playable)



13882
13883
13884
13885
13886
13887
13888
13889
13890
# File 'lib/kaltura_client.rb', line 13882

def approve(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('media', 'approve', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#approve_replace(entry_id) ⇒ Object

Approves media replacement



13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
# File 'lib/kaltura_client.rb', line 13708

def approve_replace(entry_id)
	kparams = {}
	# Media entry id to replace
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('media', 'approveReplace', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#bulk_upload_add(file_data, bulk_upload_data = KalturaNotImplemented, bulk_upload_entry_data = KalturaNotImplemented) ⇒ Object

Add new bulk upload batch job Conversion profile id can be specified in the API or in the CSV file, the one in the CSV file will be stronger. If no conversion profile was specified, partner’s default will be used



13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
# File 'lib/kaltura_client.rb', line 13922

def bulk_upload_add(file_data, bulk_upload_data=KalturaNotImplemented, bulk_upload_entry_data=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'fileData', file_data);
	client.add_param(kparams, 'bulkUploadData', bulk_upload_data);
	client.add_param(kparams, 'bulkUploadEntryData', bulk_upload_entry_data);
	client.queue_service_action_call('media', 'bulkUploadAdd', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#cancel_replace(entry_id) ⇒ Object

Cancels media replacement



13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
# File 'lib/kaltura_client.rb', line 13721

def cancel_replace(entry_id)
	kparams = {}
	# Media entry id to cancel
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('media', 'cancelReplace', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#convert(entry_id, conversion_profile_id = KalturaNotImplemented, dynamic_conversion_attributes = KalturaNotImplemented) ⇒ Object

Convert entry



13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
# File 'lib/kaltura_client.rb', line 13612

def convert(entry_id, conversion_profile_id=KalturaNotImplemented, dynamic_conversion_attributes=KalturaNotImplemented)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id);
	dynamicConversionAttributes.each do |obj|
		client.add_param(kparams, 'dynamicConversionAttributes', obj);
	end
	client.queue_service_action_call('media', 'convert', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#count(filter = KalturaNotImplemented) ⇒ Object

Count media entries by filter.



13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
# File 'lib/kaltura_client.rb', line 13749

def count(filter=KalturaNotImplemented)
	kparams = {}
	# Media entry filter
	client.add_param(kparams, 'filter', filter);
	client.queue_service_action_call('media', 'count', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#delete(entry_id) ⇒ Object

Delete a media entry.



13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
# File 'lib/kaltura_client.rb', line 13695

def delete(entry_id)
	kparams = {}
	# Media entry id to delete
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('media', 'delete', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#flag(moderation_flag) ⇒ Object

Flag inappropriate media entry for moderation



13858
13859
13860
13861
13862
13863
13864
13865
13866
# File 'lib/kaltura_client.rb', line 13858

def flag(moderation_flag)
	kparams = {}
	client.add_param(kparams, 'moderationFlag', moderation_flag);
	client.queue_service_action_call('media', 'flag', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#get(entry_id, version = -1)) ⇒ Object

Get media entry by ID.



13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
# File 'lib/kaltura_client.rb', line 13629

def get(entry_id, version=-1)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Desired version of the data
	client.add_param(kparams, 'version', version);
	client.queue_service_action_call('media', 'get', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#get_mrss(entry_id, extending_items_array = KalturaNotImplemented) ⇒ Object

Get MRSS by entry id

XML will return as an escaped string


13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
# File 'lib/kaltura_client.rb', line 13645

def get_mrss(entry_id, extending_items_array=KalturaNotImplemented)
	kparams = {}
	# Entry id
	client.add_param(kparams, 'entryId', entry_id);
	extendingItemsArray.each do |obj|
		client.add_param(kparams, 'extendingItemsArray', obj);
	end
	client.queue_service_action_call('media', 'getMrss', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#list(filter = KalturaNotImplemented, pager = KalturaNotImplemented) ⇒ Object

List media entries by filter with paging support.



13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
# File 'lib/kaltura_client.rb', line 13734

def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
	kparams = {}
	# Media entry filter
	client.add_param(kparams, 'filter', filter);
	# Pager
	client.add_param(kparams, 'pager', pager);
	client.queue_service_action_call('media', 'list', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#list_flags(entry_id, pager = KalturaNotImplemented) ⇒ Object

List all pending flags for the media entry



13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
# File 'lib/kaltura_client.rb', line 13894

def list_flags(entry_id, pager=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id);
	client.add_param(kparams, 'pager', pager);
	client.queue_service_action_call('media', 'listFlags', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#reject(entry_id) ⇒ Object

Reject the media entry and mark the pending flags (if any) as moderated (this will make the entry non playable)



13870
13871
13872
13873
13874
13875
13876
13877
13878
# File 'lib/kaltura_client.rb', line 13870

def reject(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id);
	client.queue_service_action_call('media', 'reject', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#request_conversion(entry_id, file_format) ⇒ Object

Request a new conversion job, this can be used to convert the media entry to a different format



13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
# File 'lib/kaltura_client.rb', line 13843

def request_conversion(entry_id, file_format)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Format to convert
	client.add_param(kparams, 'fileFormat', file_format);
	client.queue_service_action_call('media', 'requestConversion', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update(entry_id, media_entry) ⇒ Object

Update media entry. Only the properties that were set will be updated.



13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
# File 'lib/kaltura_client.rb', line 13661

def update(entry_id, media_entry)
	kparams = {}
	# Media entry id to update
	client.add_param(kparams, 'entryId', entry_id);
	# Media entry metadata to update
	client.add_param(kparams, 'mediaEntry', media_entry);
	client.queue_service_action_call('media', 'update', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_content(entry_id, resource, conversion_profile_id = KalturaNotImplemented, advanced_options = KalturaNotImplemented) ⇒ Object

Replace content associated with the media entry.



13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
# File 'lib/kaltura_client.rb', line 13676

def update_content(entry_id, resource, conversion_profile_id=KalturaNotImplemented, advanced_options=KalturaNotImplemented)
	kparams = {}
	# Media entry id to update
	client.add_param(kparams, 'entryId', entry_id);
	# Resource to be used to replace entry media content
	client.add_param(kparams, 'resource', resource);
	# The conversion profile id to be used on the entry
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id);
	# Additional update content options
	client.add_param(kparams, 'advancedOptions', advanced_options);
	client.queue_service_action_call('media', 'updateContent', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_thumbnail(entry_id, time_offset, flavor_params_id = KalturaNotImplemented) ⇒ Object

Update media entry thumbnail by a specified time offset (In seconds) If flavor params id not specified, source flavor will be used by default



13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
# File 'lib/kaltura_client.rb', line 13776

def update_thumbnail(entry_id, time_offset, flavor_params_id=KalturaNotImplemented)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Time offset (in seconds)
	client.add_param(kparams, 'timeOffset', time_offset);
	# The flavor params id to be used
	client.add_param(kparams, 'flavorParamsId', flavor_params_id);
	client.queue_service_action_call('media', 'updateThumbnail', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset, flavor_params_id = KalturaNotImplemented) ⇒ Object

Update media entry thumbnail from a different entry by a specified time offset (In seconds) If flavor params id not specified, source flavor will be used by default



13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
# File 'lib/kaltura_client.rb', line 13794

def update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset, flavor_params_id=KalturaNotImplemented)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Media entry id
	client.add_param(kparams, 'sourceEntryId', source_entry_id);
	# Time offset (in seconds)
	client.add_param(kparams, 'timeOffset', time_offset);
	# The flavor params id to be used
	client.add_param(kparams, 'flavorParamsId', flavor_params_id);
	client.queue_service_action_call('media', 'updateThumbnailFromSourceEntry', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_thumbnail_from_url(entry_id, url) ⇒ Object

Update entry thumbnail using url



13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
# File 'lib/kaltura_client.rb', line 13828

def update_thumbnail_from_url(entry_id, url)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	# file url
	client.add_param(kparams, 'url', url);
	client.queue_service_action_call('media', 'updateThumbnailFromUrl', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#update_thumbnail_jpeg(entry_id, file_data) ⇒ Object

Update media entry thumbnail using a raw jpeg file



13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
# File 'lib/kaltura_client.rb', line 13813

def update_thumbnail_jpeg(entry_id, file_data)
	kparams = {}
	# Media entry id
	client.add_param(kparams, 'entryId', entry_id);
	# Jpeg file data
	client.add_param(kparams, 'fileData', file_data);
	client.queue_service_action_call('media', 'updateThumbnailJpeg', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end

#upload(file_data) ⇒ Object

Upload a media file to Kaltura, then the file can be used to create a media entry.



13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
# File 'lib/kaltura_client.rb', line 13762

def upload(file_data)
	kparams = {}
	# The file data
	client.add_param(kparams, 'fileData', file_data);
	client.queue_service_action_call('media', 'upload', kparams);
	if (client.is_multirequest)
		return nil;
	end
	return client.do_queue();
end