Media Functions

The functions under the media object are now available as individual methods in the SDK version 2.


media Functions

Function or PropertyDescriptionFunction TypeReturns
media.inFolder(mediaUrls)A promise which will return a list of media URLs as specified by Folder IDPromisearray
mediaByTags(mediaUrls)A promise which will return a list of media URLs as specified by the array of one or more tags. Accepts array of strings (tags).Promisearray
media.ById(mediaUrl)A promise which will return the media's URL as specified by the media IDPromisestring

Code Samples

import { getMediaById, getMediaByTags, getMediaInFolder } from '@telemetrytv/sdk'

// Get media by ID
getMediaById('sample-media-id').then(mediaUrl => {
  console.log('Media by ID:', mediaUrl)
})

// Get media by tags
// - Return media with tag "foo" from all folders
getMediaByTags(['foo']).then(mediaUrls => {
  console.log('Media with tag "foo":', mediaUrls)
})
// - Return media with tag "foo" from folder "sample-media-folder-id"
getMediaByTags(['foo'], 'sample-media-folder-id').then(mediaUrls => {
  console.log('Media with tag "foo" in folder:', mediaUrls)
})

// Get media in folder
getMediaInFolder('sample-media-folder-id').then((mediaUrls) => {
  console.log('Media in folder:', mediaUrls)
})

What’s Next