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.



2805
2806
2807
# File 'lib/kaltura_client.rb', line 2805

def initialize(client)
  super(client)
end

Instance Method Details

#add(entry) ⇒ KalturaMediaEntry

Add entry

Returns:



2811
2812
2813
2814
2815
2816
2817
2818
2819
# File 'lib/kaltura_client.rb', line 2811

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

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.

Returns:



2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
# File 'lib/kaltura_client.rb', line 2824

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_bulk(media_entry, url, bulk_upload_id) ⇒ KalturaMediaEntry

Adds new media entry by importing an HTTP or FTP URL. The entry will be queued for import and then for conversion. This action should be exposed only to the batches

Returns:



2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
# File 'lib/kaltura_client.rb', line 2839

def add_from_bulk(media_entry, url, bulk_upload_id)
  kparams = {}
  client.add_param(kparams, 'mediaEntry', media_entry)
  client.add_param(kparams, 'url', url)
  client.add_param(kparams, 'bulkUploadId', bulk_upload_id)
  client.queue_service_action_call('media', 'addFromBulk', '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) ⇒ KalturaMediaEntry

Copy entry into new entry

Returns:



2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
# File 'lib/kaltura_client.rb', line 2853

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

Copy flavor asset into new entry

Returns:



2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
# File 'lib/kaltura_client.rb', line 2867

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

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

Returns:



2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
# File 'lib/kaltura_client.rb', line 2880

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

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

Returns:



2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
# File 'lib/kaltura_client.rb', line 2894

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

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

Returns:



2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
# File 'lib/kaltura_client.rb', line 2907

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

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

Returns:



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

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

Returns:



2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
# File 'lib/kaltura_client.rb', line 2934

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)

Returns:



2947
2948
2949
2950
2951
2952
2953
2954
2955
# File 'lib/kaltura_client.rb', line 2947

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

Approves media replacement

Returns:



2959
2960
2961
2962
2963
2964
2965
2966
2967
# File 'lib/kaltura_client.rb', line 2959

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

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

Returns:



2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
# File 'lib/kaltura_client.rb', line 2973

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

Cancels media replacement

Returns:



2988
2989
2990
2991
2992
2993
2994
2995
2996
# File 'lib/kaltura_client.rb', line 2988

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

Convert entry

Returns:

  • (bigint)


3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
# File 'lib/kaltura_client.rb', line 3000

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

Count media entries by filter.

Returns:

  • (int)


3014
3015
3016
3017
3018
3019
3020
3021
3022
# File 'lib/kaltura_client.rb', line 3014

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.

Returns:



3026
3027
3028
3029
3030
3031
3032
3033
3034
# File 'lib/kaltura_client.rb', line 3026

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

#export_to_csv(data) ⇒ string

Creates a batch job that sends an email with a link to download a CSV containing a list of entries

Returns:

  • (string)


3038
3039
3040
3041
3042
3043
3044
3045
3046
# File 'lib/kaltura_client.rb', line 3038

def export_to_csv(data)
  kparams = {}
  client.add_param(kparams, 'data', data)
  client.queue_service_action_call('media', 'exportToCsv', 'string', kparams)
  if (client.is_multirequest)
    return nil
  end
  return client.do_queue()
end

#flag(moderation_flag) ⇒ Object

Flag inappropriate media entry for moderation

Returns:



3050
3051
3052
3053
3054
3055
3056
3057
3058
# File 'lib/kaltura_client.rb', line 3050

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

Get media entry by ID.

Returns:



3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
# File 'lib/kaltura_client.rb', line 3062

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

Get MRSS by entry id

XML will return as an escaped string

Returns:

  • (string)


3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
# File 'lib/kaltura_client.rb', line 3076

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

#get_volume_map(entry_id) ⇒ file

Get volume map by entry id

Returns:

  • (file)


3090
3091
3092
3093
3094
3095
# File 'lib/kaltura_client.rb', line 3090

def get_volume_map(entry_id)
  kparams = {}
  client.add_param(kparams, 'entryId', entry_id)
  client.queue_service_action_call('media', 'getVolumeMap', 'file', kparams)
  return client.get_serve_url()
end

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

List media entries by filter with paging support.



3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
# File 'lib/kaltura_client.rb', line 3099

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

List all pending flags for the media entry



3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
# File 'lib/kaltura_client.rb', line 3112

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)

Returns:



3125
3126
3127
3128
3129
3130
3131
3132
3133
# File 'lib/kaltura_client.rb', line 3125

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

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

Returns:

  • (int)


3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
# File 'lib/kaltura_client.rb', line 3137

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

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

Returns:



3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
# File 'lib/kaltura_client.rb', line 3150

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

Replace content associated with the media entry.

Returns:



3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
# File 'lib/kaltura_client.rb', line 3163

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

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

Returns:



3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
# File 'lib/kaltura_client.rb', line 3179

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

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

Returns:



3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
# File 'lib/kaltura_client.rb', line 3194

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

Update entry thumbnail using URL

Returns:



3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
# File 'lib/kaltura_client.rb', line 3209

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

Update media entry thumbnail using a raw jpeg file

Returns:



3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
# File 'lib/kaltura_client.rb', line 3222

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

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

Returns:

  • (string)


3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
# File 'lib/kaltura_client.rb', line 3236

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