Hoshimi
Getting Started

Player Lifecycle

End-to-end player flow, search, queue, play, pause, skip, seek and destroy.

This page documents the practical playback lifecycle used by real commands. Use it as the baseline sequence for play, queue control and teardown logic.

Type reference: Core API (TypeDoc)

Quick links:

Create or Reuse

create-player.ts
import type {  } from 'hoshimi';

declare const : ;
declare const : string;
declare const : string;
declare const : string;

const  = .({
  ,
  ,
  ,
  : 100,
  : true,
});

Search and Play

search-and-play.ts
import {  } from 'hoshimi';
import type {  } from 'hoshimi';

declare const : ;

const  = await .({
  : 'Never Gonna Give You Up',
  : {
    : '123',
    : 'demo-user',
  },
});

if (. === . || . === .) {
  const  = .[0];
  await ..();

  if (!.()) {
    await .();
  }
}

Runtime Controls

runtime-controls.ts
import {  } from 'hoshimi';
import type {  } from 'hoshimi';

declare const : ;

await .(true);
await .(false);

await .(30_000);
await .({ : 1 });
await .(150);

.(.);

Disconnect vs Destroy

end-of-session.ts
import {  } from 'hoshimi';
import type {  } from 'hoshimi';

declare const : ;

await .();
await .(.);

State Gotchas

On this page