Playlist Methods
Control Studio playlist navigation. Advance pages, go back, or dynamically adjust page duration for interactive content.
Playlist Methods
Control Studio playlist navigation and timing.
Overview
The Playlist Methods allow applications embedded within Studio pages to control playlist navigation. Applications can advance to the next page, return to the previous page, or dynamically adjust the current page's display duration.
Note: These methods are specific to applications running within Studio pages. They're not available to root applications.
Importing
import { playlist } from '@telemetryos/sdk';Methods
nextPage()
Advance to the next page in the playlist.
Signature:
async nextPage(): Promise<boolean>Returns: Promise<boolean> - true if successful
Example:
// Move to next page after user interaction
button.addEventListener('click', async () => {
await playlist().nextPage();
});Throws: Error if operation fails
previousPage()
Return to the previous page in the playlist.
Signature:
async previousPage(): Promise<boolean>Returns: Promise<boolean> - true if successful
Example:
// Go back to previous page
await playlist().previousPage();Throws: Error if operation fails
setDuration()
Set the display duration for the current page. The timer starts from the moment of this call, not from when the page was first displayed.
Signature:
async setDuration(duration: number): Promise<boolean>Parameters:
duration- Duration in seconds
Returns: Promise<boolean> - true if successful
Example:
// Set page to display for 30 seconds
await playlist().setDuration(30);
// Extend duration based on content
if (hasMoreContent) {
await playlist().setDuration(60); // 60 seconds
}Throws: Error if operation fails
getDuration()
Get the predefined page duration from the playlist. Returns the original duration as configured in the playlist, not the remaining time or any value altered via setDuration().
Signature:
async getDuration(): Promise<{ success: boolean; duration: number }>Returns: Promise<{ success: boolean; duration: number }> - Duration in seconds, or 0 if undefined
Example:
// Get the configured page duration
const { duration } = await playlist().getDuration();
console.log(`Page duration: ${duration} seconds`);
// Use duration to schedule content
const { duration } = await playlist().getDuration();
if (duration > 15) {
showExtendedContent();
}Throws: Error if operation fails
Next Steps
- Overrides API - Emergency alerts and content overrides
- Storage API - Persist navigation state
- Code Examples - Complete playlist control examples
Updated about 1 hour ago