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.



11416
11417
11418
# File 'lib/kaltura_client.rb', line 11416

def initialize(client)
	super(client)
end

Instance Method Details

#add(entry) ⇒ Object

Add entry



11422
11423
11424
11425
11426
11427
11428
11429
11430
# File 'lib/kaltura_client.rb', line 11422

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.


11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
# File 'lib/kaltura_client.rb', line 11435

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



11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
# File 'lib/kaltura_client.rb', line 11510

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



11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
# File 'lib/kaltura_client.rb', line 11527

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



11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
# File 'lib/kaltura_client.rb', line 11495

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.



11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
# File 'lib/kaltura_client.rb', line 11465

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



11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
# File 'lib/kaltura_client.rb', line 11480

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.



11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
# File 'lib/kaltura_client.rb', line 11449

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



11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
# File 'lib/kaltura_client.rb', line 11835

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)



11810
11811
11812
11813
11814
11815
11816
11817
11818
# File 'lib/kaltura_client.rb', line 11810

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



11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
# File 'lib/kaltura_client.rb', line 11636

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



11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
# File 'lib/kaltura_client.rb', line 11850

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



11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
# File 'lib/kaltura_client.rb', line 11649

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



11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
# File 'lib/kaltura_client.rb', line 11542

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.



11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
# File 'lib/kaltura_client.rb', line 11677

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.



11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
# File 'lib/kaltura_client.rb', line 11623

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



11786
11787
11788
11789
11790
11791
11792
11793
11794
# File 'lib/kaltura_client.rb', line 11786

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.



11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
# File 'lib/kaltura_client.rb', line 11559

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


11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
# File 'lib/kaltura_client.rb', line 11575

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.



11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
# File 'lib/kaltura_client.rb', line 11662

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



11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
# File 'lib/kaltura_client.rb', line 11822

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)



11798
11799
11800
11801
11802
11803
11804
11805
11806
# File 'lib/kaltura_client.rb', line 11798

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



11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
# File 'lib/kaltura_client.rb', line 11771

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.



11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
# File 'lib/kaltura_client.rb', line 11591

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) ⇒ Object

Replace content associated with the media entry.



11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
# File 'lib/kaltura_client.rb', line 11606

def update_content(entry_id, resource, conversion_profile_id=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);
	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



11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
# File 'lib/kaltura_client.rb', line 11704

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



11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
# File 'lib/kaltura_client.rb', line 11722

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



11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
# File 'lib/kaltura_client.rb', line 11756

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



11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
# File 'lib/kaltura_client.rb', line 11741

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.



11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
# File 'lib/kaltura_client.rb', line 11690

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