0.1.0 • Published 2 years ago

crestron-mediaplayer-sdk v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

SDK package for CRPC, to integrate into a mediaplayer.

ci

Initial works from the MVP https://github.com/JayLiaProgramming/MediaPlayer rewrote into SDK-like package to hopefully in the future make integrations with the CRPC streams easy.

NOT READY FOR USE YET

const container = new CrpcContainer('5db35e97-a379-46e4-ac32-6b16d5ed6d3e');

// When server sends data, run it into
container.pipeFromServer('{rpc data from server}');

// Whenever the SDK generates data, send it back to the server.
const subscription = container.pipeToServer.subscribe({
    next: (data: string) =>
    {
        // send "data" to server!
    },
});

// After setting this up, initialize (async method)
await container.initialize();

// Get browser and watch title, when subscribing to a property it should automatically be retrieved by the SDK
if (container.browser) {
    // Initialize browser before using it!
    container.browser.initialize();

    container.browser.title$.subscribe({
        next: (title: string) => console.log(`Received title: ${title}`),
    });

    container.browser.items$.subscribe({
        next: (items: ListItem[]) => {
            console.log('Received browsable items: ', items)
            
            // Select item
            items[0].select()
        },
    });

    container.browser.functions$.subscribe({
        next: (listFunctions: ListFunction[]) => {
            console.log('Received executable functions', listFunctions);
            
            // Execute function
            listFunctions[0].execute()
        }
    });
}

// Getting now playing lines
if (container.player) {
    container.player.initialize();
    container.player.textLines$.subscribe({
        next: (lines: string[]) =>
            console.log(`Received now playing text lines: ${lines.join(' - ')}`),
    });

    // Or start playing
    container.player.play();
}
0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago