Class: Kaltura::Service::MediaService
- Inherits:
-
BaseService
- Object
- BaseService
- Kaltura::Service::MediaService
- Defined in:
- lib/kaltura/service/media_service.rb
Overview
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
-
#add_from_bulk(media_entry, url, bulk_upload_id) ⇒ Kaltura::MediaEntry
This method creates a new media entry from either a HTTP or FTP URL given a batch ID.
-
#add_from_entry(media_entry, source_entry_id, source_flavor_params_id = nil) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
-
#add_from_flavor_asset(media_entry, source_flavor_asset_id) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
- #add_from_recorded_webcam(media_entry, webcam_token_id) ⇒ Object
-
#add_from_search_result(media_entry = nil, search_result = nil) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
-
#add_from_uploaded_file(media_entry, upload_token_id) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
-
#add_from_url(media_entry, url) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
-
#anonymous_rank(entry_id, rank) ⇒ nil
Rank a media entry.
-
#approve(entry_id) ⇒ nil
Approves the media entry and marks all pending flags as moderated.
-
#convert(entry_id, conversion_profile_id, dynamic_conversion_attributes = nil) ⇒ Integer
Converts a media entry.
-
#count(filter = nil) ⇒ Integer
Counts the total number of media entries that meet the filter criteria.
- #delete(entry_id) ⇒ Object
-
#flag(moderation_flag) ⇒ nil
Flags an inappropriate media entry for moderation.
-
#get(entry_id, version = -1)) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
-
#list(filter = nil, pager = nil) ⇒ Kaltura::Response::MediaListResponse
Lists media entries given a filter and provides paging support for large lists.
-
#list_flags(entry_id, pager = nil) ⇒ Kaltura::Response::ModerationFlagListResponse
Lists all pending moderation flags for the media entry with paging support for numerous flags.
-
#reject(entry_id) ⇒ nil
Rejects the media entry and marks all pending flags as moderated.
-
#request_conversion(entry_id, file_format) ⇒ Integer
Requests a new conversion job.
-
#update(entry_id, media_entry) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set.
-
#update_thumbnail(entry_id, time_offset) ⇒ Kaltura::MediaEntry
Updates a specific media entries thumbnail by a specified time offset in seconds.
-
#update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset) ⇒ Kaltura::MediaEntry
Updates a media entries thumbnail from another media entry given a time offset.
-
#update_thumbnail_from_url(entry_id, url) ⇒ Kaltura::MediaEntry
Updates a media entries thumbnail given a URL.
-
#update_thumbnail_jpeg(entry_id, file_data) ⇒ Kaltura::MediaEntry
Updates a media entries thumbnail from a JPEG file.
-
#upload(file_data) ⇒ String
Uploads a media file to Kaltura.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Kaltura::Service::BaseService
Instance Method Details
#add_from_bulk(media_entry, url, bulk_upload_id) ⇒ Kaltura::MediaEntry
This method creates a new media entry from either a HTTP or FTP URL given a batch ID.
The intention of this action is to import videos in large quantities from another service without overloading either the former service nor Kaltura. This is probably best handled from within the KMC with their batch importing wizard, even though this is exposed to anyone on API wrappers.
63 64 65 66 67 68 69 |
# File 'lib/kaltura/service/media_service.rb', line 63 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) perform_request('media','addFromBulk',kparams,false) end |
#add_from_entry(media_entry, source_entry_id, source_flavor_params_id = nil) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
213 214 215 216 217 218 219 |
# File 'lib/kaltura/service/media_service.rb', line 213 def add_from_entry(media_entry, source_entry_id,source_flavor_params_id=nil) kparams = {} client.add_params(kparams,'mediaEntry',media_entry) client.add_params(kparams,'sourceEntryId',source_entry_id) client.add_params(kparams,'sourceFlavorParamsId',source_flavor_params_id) perform_request('media','addFromEntry',kparams,false) end |
#add_from_flavor_asset(media_entry, source_flavor_asset_id) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
236 237 238 239 240 241 |
# File 'lib/kaltura/service/media_service.rb', line 236 def add_from_flavor_asset(media_entry, source_flavor_asset_id) kparams = {} client.add_params(kparams,'mediaEntry',media_entry) client.add_params(kparams,'sourceFlavorAssetId',source_flavor_asset_id) perform_request('media','addFromFlavorAsset',kparams,false) end |
#add_from_recorded_webcam(media_entry, webcam_token_id) ⇒ Object
184 185 186 187 188 189 |
# File 'lib/kaltura/service/media_service.rb', line 184 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) perform_request('media','addFromRecordedWebcam',kparams,false) end |
#add_from_search_result(media_entry = nil, search_result = nil) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
119 120 121 122 123 124 |
# File 'lib/kaltura/service/media_service.rb', line 119 def add_from_search_result(media_entry=nil, search_result=nil) kparams = {} client.add_param(kparams, 'mediaEntry', media_entry) client.add_param(kparams, 'searchResult', search_result) perform_request('media','addFromSearchResult',kparams,false) end |
#add_from_uploaded_file(media_entry, upload_token_id) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
156 157 158 159 160 161 |
# File 'lib/kaltura/service/media_service.rb', line 156 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) perform_request('media','addFromUploadedFile',kparams,false) end |
#add_from_url(media_entry, url) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
93 94 95 96 97 98 |
# File 'lib/kaltura/service/media_service.rb', line 93 def add_from_url(media_entry, url) kparams = {} client.add_param(kparams, 'mediaEntry', media_entry) client.add_param(kparams, 'url', url) perform_request('media','addFromUrl',kparams,false) end |
#anonymous_rank(entry_id, rank) ⇒ nil
Rank a media entry. This does no validation to prevent duplicate rankings. Fairly worthless. It is suggested you maintain rankings on your own application.
538 539 540 541 542 543 |
# File 'lib/kaltura/service/media_service.rb', line 538 def anonymous_rank(entry_id, rank) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'rank', rank) perform_request('media','anonymousRank',kparams,false) end |
#approve(entry_id) ⇒ nil
Approves the media entry and marks all pending flags as moderated. This makes the entry playable.
503 504 505 506 507 |
# File 'lib/kaltura/service/media_service.rb', line 503 def approve(entry_id) kparams = {} client.add_param(kparams, 'entryId', entry_id) perform_request('media','approve',kparams,false) end |
#convert(entry_id, conversion_profile_id, dynamic_conversion_attributes = nil) ⇒ Integer
Add Kaltura::ConversionAttribute.
Converts a media entry. This method was not originallly in kaltura-ruby and was added after peruising the API docs. I wouldn’t suggest using this method. Any upload action will already trigger a conversion, so instead use request conversion.
260 261 262 263 264 265 266 |
# File 'lib/kaltura/service/media_service.rb', line 260 def convert(entry_id,conversion_profile_id,dynamic_conversion_attributes=nil) kparams = {} client.add_params(kparams,'entryId',entry_id) client.add_params(kparams,'conversionProfileId',conversion_profile_id) client.add_params(kparams,'dynamicConversionAttributes',dynamic_conversion_attributes) perform_request('media','convert',kparams,false) end |
#count(filter = nil) ⇒ Integer
Counts the total number of media entries that meet the filter criteria.
350 351 352 353 354 |
# File 'lib/kaltura/service/media_service.rb', line 350 def count(filter=nil) kparams = {} client.add_param(kparams, 'filter', filter) perform_request('media','count',kparams,false) end |
#delete(entry_id) ⇒ Object
318 319 320 321 322 |
# File 'lib/kaltura/service/media_service.rb', line 318 def delete(entry_id) kparams = {} client.add_param(kparams, 'entryId', entry_id) perform_request('media','delete',kparams,false) end |
#flag(moderation_flag) ⇒ nil
Flags an inappropriate media entry for moderation.
471 472 473 474 475 |
# File 'lib/kaltura/service/media_service.rb', line 471 def flag(moderation_flag) kparams = {} client.add_param(kparams, 'moderationFlag', moderation_flag) perform_request('media','flag',kparams,false) end |
#get(entry_id, version = -1)) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
280 281 282 283 284 285 |
# File 'lib/kaltura/service/media_service.rb', line 280 def get(entry_id, version=-1) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'version', version) perform_request('media','get',kparams,false) end |
#list(filter = nil, pager = nil) ⇒ Kaltura::Response::MediaListResponse
Lists media entries given a filter and provides paging support for large lists.
334 335 336 337 338 339 |
# File 'lib/kaltura/service/media_service.rb', line 334 def list(filter=nil, pager=nil) kparams = {} client.add_param(kparams, 'filter', filter) client.add_param(kparams, 'pager', pager) perform_request('media','list',kparams,false) end |
#list_flags(entry_id, pager = nil) ⇒ Kaltura::Response::ModerationFlagListResponse
Lists all pending moderation flags for the media entry with paging support for numerous flags.
519 520 521 522 523 524 |
# File 'lib/kaltura/service/media_service.rb', line 519 def list_flags(entry_id, pager=nil) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'pager', pager) perform_request('media','listFlags',kparams,false) end |
#reject(entry_id) ⇒ nil
Rejects the media entry and marks all pending flags as moderated. This makes the entry non-playable.
487 488 489 490 491 |
# File 'lib/kaltura/service/media_service.rb', line 487 def reject(entry_id) kparams = {} client.add_param(kparams, 'entryId', entry_id) perform_request('media','request',kparams,false) end |
#request_conversion(entry_id, file_format) ⇒ Integer
Requests a new conversion job.
Use this over Kaltura::Service::MediaService#convert.
455 456 457 458 459 460 |
# File 'lib/kaltura/service/media_service.rb', line 455 def request_conversion(entry_id, file_format) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'fileFormat', file_format) perform_request('media','requestConversion',kparams,false) end |
#update(entry_id, media_entry) ⇒ Kaltura::MediaEntry
Returns a media entry object with the metadata fields filled out with the additional database fields the Kaltura service set. It would be a good idea to store the ID somewhere.
302 303 304 305 306 307 |
# File 'lib/kaltura/service/media_service.rb', line 302 def update(entry_id, media_entry) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'mediaEntry', media_entry) perform_request('media','update',kparams,false) end |
#update_thumbnail(entry_id, time_offset) ⇒ Kaltura::MediaEntry
Updates a specific media entries thumbnail by a specified time offset in seconds.
384 385 386 387 388 389 |
# File 'lib/kaltura/service/media_service.rb', line 384 def update_thumbnail(entry_id, time_offset) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'timeOffset', time_offset) perform_request('media','updateThumbnail',kparams,false) end |
#update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset) ⇒ Kaltura::MediaEntry
Updates a media entries thumbnail from another media entry given a time offset.
402 403 404 405 406 407 408 |
# File 'lib/kaltura/service/media_service.rb', line 402 def update_thumbnail_from_source_entry(entry_id, source_entry_id, time_offset) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'sourceEntryId', source_entry_id) client.add_param(kparams, 'timeOffset', time_offset) perform_request('media','updateThumbnailFromSourceEntry',kparams,false) end |
#update_thumbnail_from_url(entry_id, url) ⇒ Kaltura::MediaEntry
Updates a media entries thumbnail given a URL.
437 438 439 440 441 442 |
# File 'lib/kaltura/service/media_service.rb', line 437 def update_thumbnail_from_url(entry_id, url) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'url', url) perform_request('media','updateThumbnailFromUrl',kparams,false) end |
#update_thumbnail_jpeg(entry_id, file_data) ⇒ Kaltura::MediaEntry
Updates a media entries thumbnail from a JPEG file.
420 421 422 423 424 425 |
# File 'lib/kaltura/service/media_service.rb', line 420 def update_thumbnail_jpeg(entry_id, file_data) kparams = {} client.add_param(kparams, 'entryId', entry_id) client.add_param(kparams, 'fileData', file_data) perform_request('media','updateThumbnailJpeg',kparams,false) end |
#upload(file_data) ⇒ String
Uploads a media file to Kaltura.
This is the first step in creating a media entry from a local file.
368 369 370 371 372 |
# File 'lib/kaltura/service/media_service.rb', line 368 def upload(file_data) kparams = {} client.add_param(kparams, 'fileData', file_data) perform_request('media','upload',kparams,false) end |