Media Functions
The functions under the media
object are now available as individual methods in the SDK version 2.
media Functions
Function or Property | Description | Function Type | Returns |
---|---|---|---|
media.inFolder(mediaUrls) | A promise which will return a list of media URLs as specified by Folder ID | Promise | array |
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). | Promise | array |
media.ById(mediaUrl) | A promise which will return the media's URL as specified by the media ID | Promise | string |
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)
})
Updated 4 months ago
What’s Next