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.



2679
2680
2681
# File 'lib/kaltura_client.rb', line 2679

def initialize(client)
	super(client)
end

Instance Method Details

#add(entry) ⇒ Object

Add entry



2685
2686
2687
2688
2689
2690
2691
2692
2693
# File 'lib/kaltura_client.rb', line 2685

def add(entry)
	kparams = {}
	client.add_param(kparams, 'entry', entry)
	client.queue_service_action_call('media', 'add', 'KalturaMediaEntry', 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.


2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
# File 'lib/kaltura_client.rb', line 2698

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', 'KalturaMediaEntry', 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



2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
# File 'lib/kaltura_client.rb', line 2765

def add_from_entry(source_entry_id, media_entry=KalturaNotImplemented, source_flavor_params_id=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'sourceEntryId', source_entry_id)
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.add_param(kparams, 'sourceFlavorParamsId', source_flavor_params_id)
	client.queue_service_action_call('media', 'addFromEntry', 'KalturaMediaEntry', 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



2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
# File 'lib/kaltura_client.rb', line 2779

def add_from_flavor_asset(source_flavor_asset_id, media_entry=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'sourceFlavorAssetId', source_flavor_asset_id)
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.queue_service_action_call('media', 'addFromFlavorAsset', 'KalturaMediaEntry', 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



2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
# File 'lib/kaltura_client.rb', line 2752

def add_from_recorded_webcam(media_entry, webcam_token_id)
	kparams = {}
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.add_param(kparams, 'webcamTokenId', webcam_token_id)
	client.queue_service_action_call('media', 'addFromRecordedWebcam', 'KalturaMediaEntry', 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.



2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/kaltura_client.rb', line 2726

def add_from_search_result(media_entry=KalturaNotImplemented, search_result=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.add_param(kparams, 'searchResult', search_result)
	client.queue_service_action_call('media', 'addFromSearchResult', 'KalturaMediaEntry', 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



2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
# File 'lib/kaltura_client.rb', line 2739

def add_from_uploaded_file(media_entry, upload_token_id)
	kparams = {}
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.add_param(kparams, 'uploadTokenId', upload_token_id)
	client.queue_service_action_call('media', 'addFromUploadedFile', 'KalturaMediaEntry', 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.



2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
# File 'lib/kaltura_client.rb', line 2712

def add_from_url(media_entry, url)
	kparams = {}
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.add_param(kparams, 'url', url)
	client.queue_service_action_call('media', 'addFromUrl', 'KalturaMediaEntry', 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



3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
# File 'lib/kaltura_client.rb', line 3056

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)



3031
3032
3033
3034
3035
3036
3037
3038
3039
# File 'lib/kaltura_client.rb', line 3031

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



2874
2875
2876
2877
2878
2879
2880
2881
2882
# File 'lib/kaltura_client.rb', line 2874

def approve_replace(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.queue_service_action_call('media', 'approveReplace', 'KalturaMediaEntry', 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



3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
# File 'lib/kaltura_client.rb', line 3071

def bulk_upload_add(file_data, bulk_upload_data=KalturaNotImplemented, bulk_upload_entry_data=KalturaNotImplemented)
	kparams = {}
	kfiles = {}
	client.add_param(kfiles, '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', 'KalturaBulkUpload', kparams, kfiles)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#cancel_replace(entry_id) ⇒ Object

Cancels media replacement



2886
2887
2888
2889
2890
2891
2892
2893
2894
# File 'lib/kaltura_client.rb', line 2886

def cancel_replace(entry_id)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.queue_service_action_call('media', 'cancelReplace', 'KalturaMediaEntry', 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



2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
# File 'lib/kaltura_client.rb', line 2792

def convert(entry_id, conversion_profile_id=KalturaNotImplemented, dynamic_conversion_attributes=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id)
	client.add_param(kparams, 'dynamicConversionAttributes', dynamic_conversion_attributes)
	client.queue_service_action_call('media', 'convert', 'bigint', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#count(filter = KalturaNotImplemented) ⇒ Object

Count media entries by filter.



2911
2912
2913
2914
2915
2916
2917
2918
2919
# File 'lib/kaltura_client.rb', line 2911

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

#delete(entry_id) ⇒ Object

Delete a media entry.



2862
2863
2864
2865
2866
2867
2868
2869
2870
# File 'lib/kaltura_client.rb', line 2862

def delete(entry_id)
	kparams = {}
	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



3007
3008
3009
3010
3011
3012
3013
3014
3015
# File 'lib/kaltura_client.rb', line 3007

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.



2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
# File 'lib/kaltura_client.rb', line 2806

def get(entry_id, version=-1)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'version', version)
	client.queue_service_action_call('media', 'get', 'KalturaMediaEntry', kparams)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end

#get_mrss(entry_id, extending_items_array = KalturaNotImplemented, features = KalturaNotImplemented) ⇒ Object

Get MRSS by entry id

XML will return as an escaped string


2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
# File 'lib/kaltura_client.rb', line 2820

def get_mrss(entry_id, extending_items_array=KalturaNotImplemented, features=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'extendingItemsArray', extending_items_array)
	client.add_param(kparams, 'features', features)
	client.queue_service_action_call('media', 'getMrss', 'string', 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.



2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
# File 'lib/kaltura_client.rb', line 2898

def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'filter', filter)
	client.add_param(kparams, 'pager', pager)
	client.queue_service_action_call('media', 'list', 'KalturaMediaListResponse', 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



3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
# File 'lib/kaltura_client.rb', line 3043

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', 'KalturaModerationFlagListResponse', 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)



3019
3020
3021
3022
3023
3024
3025
3026
3027
# File 'lib/kaltura_client.rb', line 3019

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



2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
# File 'lib/kaltura_client.rb', line 2994

def request_conversion(entry_id, file_format)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'fileFormat', file_format)
	client.queue_service_action_call('media', 'requestConversion', 'int', 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.



2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
# File 'lib/kaltura_client.rb', line 2834

def update(entry_id, media_entry)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'mediaEntry', media_entry)
	client.queue_service_action_call('media', 'update', 'KalturaMediaEntry', 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.



2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
# File 'lib/kaltura_client.rb', line 2847

def update_content(entry_id, resource, conversion_profile_id=KalturaNotImplemented, advanced_options=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'resource', resource)
	client.add_param(kparams, 'conversionProfileId', conversion_profile_id)
	client.add_param(kparams, 'advancedOptions', advanced_options)
	client.queue_service_action_call('media', 'updateContent', 'KalturaMediaEntry', 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



2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
# File 'lib/kaltura_client.rb', line 2937

def update_thumbnail(entry_id, time_offset, flavor_params_id=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'timeOffset', time_offset)
	client.add_param(kparams, 'flavorParamsId', flavor_params_id)
	client.queue_service_action_call('media', 'updateThumbnail', 'KalturaMediaEntry', 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



2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
# File 'lib/kaltura_client.rb', line 2952

def update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset, flavor_params_id=KalturaNotImplemented)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'sourceEntryId', source_entry_id)
	client.add_param(kparams, 'timeOffset', time_offset)
	client.add_param(kparams, 'flavorParamsId', flavor_params_id)
	client.queue_service_action_call('media', 'updateThumbnailFromSourceEntry', 'KalturaMediaEntry', 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



2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
# File 'lib/kaltura_client.rb', line 2981

def update_thumbnail_from_url(entry_id, url)
	kparams = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kparams, 'url', url)
	client.queue_service_action_call('media', 'updateThumbnailFromUrl', 'KalturaBaseEntry', 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



2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
# File 'lib/kaltura_client.rb', line 2967

def update_thumbnail_jpeg(entry_id, file_data)
	kparams = {}
	kfiles = {}
	client.add_param(kparams, 'entryId', entry_id)
	client.add_param(kfiles, 'fileData', file_data)
	client.queue_service_action_call('media', 'updateThumbnailJpeg', 'KalturaMediaEntry', kparams, kfiles)
	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.



2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
# File 'lib/kaltura_client.rb', line 2923

def upload(file_data)
	kparams = {}
	kfiles = {}
	client.add_param(kfiles, 'fileData', file_data)
	client.queue_service_action_call('media', 'upload', 'string', kparams, kfiles)
	if (client.is_multirequest)
		return nil
	end
	return client.do_queue()
end