Overview
The Playlist Get/Set API allows to programmatically receive and set a video playlist from/to Anyclip's player. You can begin calling API functions on an AnyClip player only after the playerReady event for this particular widget has been fired.
Get Playlist
Anyclip's player must first be initialized. Once initialized, the player will request and receive a relevant playlist from AnyClip servers. Once this step is complete, the playlist can be received programmatically from the player using the following method:
getTMplaylist()
This method returns an array of clip objects (e.g. a playlist). The playlist can be manipulated (reordered etc.) and then sent back to the player.
An example of the playlist data returned when the getTMplaylist() method is executed is shown below:
Playlist Example
{
"playlist": [{
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408742277_1280x720_video.mp4",
"hlsFile": {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/hls_1629408718230/master.m3u8"
},
"image": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408689199_248x140_thumbnail.jpg",
"title": "Know Your Meme: Think, Mark!",
"mediaid": "lfkdcu2zjbzue3btob3wirkggzvgorlr",
"plot": "Think, Mark is a phrase said during a climactic moment of the Amazon Prime show Invincible that began airing in 2021. Used as an exploitable image macro, the main focus of the meme is on the one saying the phrase, which is Omni-Man, a main character and secret antagonist. The brutal way in which the character, voiced by JK Simmons, yells in this scene has inspired many memes to be made of it, as well as various redraws.\n\nCheck out our \"Think, Mark\" entry: https://knowyourmeme.com/memes/think-mark\n\n#thinkmark #invincible #thinkmarkmemes",
"score": 1.62095129E12,
"landingPageLink": "https://www.youtube.com/watch?v=Vr3PzUk1ajw",
"contentOwner": 1658,
"files": [{
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408741384_480x270_video.mp4",
"width": 480,
"height": 270
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408741620_640x360_video.mp4",
"width": 640,
"height": 360
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408741871_852x480_video.mp4",
"width": 852,
"height": 480
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408742277_1280x720_video.mp4",
"width": 1280,
"height": 720
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408742667_1920x1080_video.mp4",
"width": 1920,
"height": 1080
}
],
"created": 1620951290000,
"duration": 147417,
"images": [{
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408689199_248x140_thumbnail.jpg",
"width": 248,
"height": 140
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408689276_480x270_thumbnail.jpg",
"width": 480,
"height": 270
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408689229_640x360_thumbnail.jpg",
"width": 640,
"height": 360
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408689124_852x480_thumbnail.jpg",
"width": 852,
"height": 480
}, {
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408689086_1280x720_thumbnail.jpg",
"width": 1280,
"height": 720
}
],
"lang": ["EN"],
"performanceData": {
"time": 1684231200000,
"parameters": [{
"type": "VIEW",
"value": 20278075
}, {
"type": "LIKE",
"value": 651
}, {
"type": "SHARE",
"value": 0
}
]
},
"previewUrl": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/1629408692346_preview.mp4",
"defaultOrder": 0,
"videoId": "YT1SYHsBl3pwdEF6jgEq",
"ccFiles": [{
"file": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/cc/EN/1629408699119_subtitles.vtt",
"lang": "EN",
"langName": "English"
}
],
"refId": "Vr3PzUk1ajw",
"targetingStatus": "OFF",
"ccUrl": "https://cdn5.anyclip.com/YT1SYHsBl3pwdEF6jgEq/cc/EN/1629408699119_subtitles.vtt"
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408325144_1280x720_video.mp4",
"hlsFile": {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/hls_1629408261067/master.m3u8"
},
"image": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408168822_248x140_thumbnail.jpg",
"title": "We Fixed Mortal Kombat (2021)",
"mediaid": "jbchqs2zjbzue3btob3wirkggy2xit3s",
"plot": "The 2021 Mortal Kombat was pretty cool",
"score": 1.620414004E12,
"landingPageLink": "https://www.youtube.com/watch?v=5rVEUTD9ZOU",
"contentOwner": 1658,
"files": [{
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408323971_480x270_video.mp4",
"width": 480,
"height": 270
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408324427_640x360_video.mp4",
"width": 640,
"height": 360
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408324802_852x480_video.mp4",
"width": 852,
"height": 480
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408325144_1280x720_video.mp4",
"width": 1280,
"height": 720
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408325599_1920x1080_video.mp4",
"width": 1920,
"height": 1080
}
],
"created": 1620414004000,
"duration": 405875,
"images": [{
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408168822_248x140_thumbnail.jpg",
"width": 248,
"height": 140
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408168791_480x270_thumbnail.jpg",
"width": 480,
"height": 270
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408168759_640x360_thumbnail.jpg",
"width": 640,
"height": 360
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408168851_852x480_thumbnail.jpg",
"width": 852,
"height": 480
}, {
"file": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408168646_1280x720_thumbnail.jpg",
"width": 1280,
"height": 720
}
],
"lang": ["EN"],
"performanceData": {
"time": 1684231200000,
"parameters": [{
"type": "VIEW",
"value": 20448114
}, {
"type": "LIKE",
"value": 685
}, {
"type": "SHARE",
"value": 0
}
]
},
"previewUrl": "https://cdn5.anyclip.com/HDxKYHsBl3pwdEF65tOr/1629408266000_preview.mp4",
"defaultOrder": 1,
"videoId": "HDxKYHsBl3pwdEF65tOr",
"refId": "5rVEUTD9ZOU",
"targetingStatus": "OFF"
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408440200_1280x720_video.mp4",
"hlsFile": {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/hls_1629408379041/master.m3u8"
},
"image": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408215137_248x140_thumbnail.jpg",
"title": "Why are there so many dirty magazines in the woods?",
"mediaid": "n5vhqtczjbzue3btob3wirkggzhdsvby",
"plot": "People born before 1990 know exactly what we’re talking about when we discuss the ancient, mystical tradition of finding dirty magazine stashes in the woods. Who put them there? Dads? Other kids? Big... Dirty? Join us this week as Melissa plunges into this particularly strange nostalgia wormhole and proves that, yes, this phenomenon is a REAL THING. Ned Gayle: https://www.youtube.com/watch?v=eDpZGHHx9Nk\nBrad Silnutzer: https://www.youtube.com/watch?v=UEuLsfzW52E",
"score": 1.605902415E12,
"landingPageLink": "https://www.youtube.com/watch?v=lRAfoxMuVn8",
"contentOwner": 1658,
"files": [{
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408438919_480x270_video.mp4",
"width": 480,
"height": 270
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408439320_640x360_video.mp4",
"width": 640,
"height": 360
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408439732_852x480_video.mp4",
"width": 852,
"height": 480
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408440200_1280x720_video.mp4",
"width": 1280,
"height": 720
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408440900_1920x1080_video.mp4",
"width": 1920,
"height": 1080
}
],
"created": 1605902415000,
"duration": 403625,
"images": [{
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408215137_248x140_thumbnail.jpg",
"width": 248,
"height": 140
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408215228_480x270_thumbnail.jpg",
"width": 480,
"height": 270
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408215163_640x360_thumbnail.jpg",
"width": 640,
"height": 360
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408215107_852x480_thumbnail.jpg",
"width": 852,
"height": 480
}, {
"file": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408215029_1280x720_thumbnail.jpg",
"width": 1280,
"height": 720
}
],
"lang": ["EN"],
"performanceData": {
"time": 1684231200000,
"parameters": [{
"type": "VIEW",
"value": 20412678
}, {
"type": "LIKE",
"value": 762
}, {
"type": "SHARE",
"value": 0
}
]
},
"previewUrl": "https://cdn5.anyclip.com/ojxLYHsBl3pwdEF6N9T8/1629408326771_preview.mp4",
"defaultOrder": 2,
"videoId": "ojxLYHsBl3pwdEF6N9T8",
"refId": "lRAfoxMuVn8",
"targetingStatus": "OFF"
}
]
Set Playlist
You can programmatically set a playlist to an AnyClip player. The method used to do this is:
setPlaylist(playlist)
The playlist parameter must be an object in the same format as received by the getTMplaylist function.
Set Playlist with a specific Timestamp
The setPlaylist function can be used with a second parameter that determines the start time of the first Video in the playlist in MS, accordingly:
setPlaylist([playlist],{startFromTime: 957})