libtizyoutube

group libtizyoutube

library

A C library to access audio from the YouTube streaming service.

Typedefs

typedef struct tiz_youtube tiz_youtube_t

The youtube opaque structure

typedef enum tiz_youtube_playback_mode tiz_youtube_playback_mode_t

Various playback modes that control the playback queue.

Enums

enum tiz_youtube_playback_mode

Various playback modes that control the playback queue.

Values:

ETIZYoutubePlaybackModeNormal
ETIZYoutubePlaybackModeShuffle
ETIZYoutubePlaybackModeMax

Functions

int tiz_youtube_init(tiz_youtube_ptr_t * app_youtube)

Initialize the tiz_youtube handle.

Return
0 on success.
Parameters
  • app_youtube: A pointer to the tiz_youtube handle which will be initialised.

void tiz_youtube_clear_queue(tiz_youtube_t * ap_youtube)

Clear the playback queue.

Parameters
  • ap_youtube: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_index(tiz_youtube_t * ap_youtube)

Retrieve the index in the playback queue of the stream currently selected.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_queue_length(tiz_youtube_t * ap_youtube)

Retrieve the current length of playback queue.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_queue_progress(tiz_youtube_t * ap_youtube)

Retrieve the current queue progress (e.g. ‘5 of 17’, where 5 is the current stream index, and 17 is the total streams in the queue).

Parameters
  • ap_gmusic: The tiz_youtube handle.

void tiz_youtube_set_playback_mode(tiz_youtube_t * ap_youtube, const tiz_youtube_playback_mode_t mode)

Set the playback mode (normal, shuffle).

Parameters
  • ap_youtube: The tiz_youtube handle.

int tiz_youtube_play_audio_stream(tiz_youtube_t * ap_youtube, const char * ap_url_or_id)

Add a YouTube audio stream to the playback queue.

After calling this method, the various tiz_youtube_get* methods can be used to interact with the playback queue.

Return
0 on success
Parameters
  • ap_youtube: The tiz_youtube handle.
  • ap_url_or_id: A YouTube video full url or video id.

int tiz_youtube_play_audio_playlist(tiz_youtube_t * ap_youtube, const char * ap_url_or_id)

Add all the audio streams of a YouTube playlist to the playback queue.

After calling this method, the various tiz_youtube_get* methods can be used to interact with the playback queue.

Return
0 on success
Parameters
  • ap_youtube: The tiz_youtube handle.
  • ap_url_or_id: A playlist full url or playlist id.

int tiz_youtube_play_audio_mix(tiz_youtube_t * ap_youtube, const char * ap_url_or_id)

Retrieve the YouTube mix associated to given video id or url andd all the audio streams of the mix to the playback queue.

After calling this method, the various tiz_youtube_get* methods can be used to interact with the playback queue.

Return
0 on success
Parameters
  • ap_youtube: The tiz_youtube handle.
  • ap_url_or_id: A playlist url or playlist id.

Add all the audio streams of a YouTube search to the playback queue.

After calling this method, the various tiz_youtube_get* methods can be used to interact with the playback queue.

Return
0 on success
Parameters
  • ap_youtube: The tiz_youtube handle.
  • ap_search: A search term.

Retrieve the YouTube mix associated to given search term and add all the audio streams of the mix to the playback queue.

After calling this method, the various tiz_youtube_get* methods can be used to interact with the playback queue.

Return
0 on success
Parameters
  • ap_youtube: The tiz_youtube handle.
  • ap_search: A search term.

const char* tiz_youtube_get_next_url(tiz_youtube_t * ap_youtube, const bool a_remove_current_url)

Retrieve the next stream url

The playback queue pointer moves one position forwards.

Return
The next url in the playback queue or NULL if the playback queue is empty.
Parameters
  • ap_youtube: The tiz_youtube handle.
  • a_remove_current_url: If true, delete the current url from the playback queue before moving to the next url.

const char* tiz_youtube_get_prev_url(tiz_youtube_t * ap_youtube, const bool a_remove_current_url)

Retrieve the previous stream url.

The playback queue pointer moves one position backwards.

Return
The previous url in the playback queue or NULL if the playback queue is empty.
Parameters
  • ap_youtube: The tiz_youtube handle.
  • a_remove_current_url: If true, delete the current url from the playback queue before moving to the previous url.

const char* tiz_youtube_get_current_audio_stream_title(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s title.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_author(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s author.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_file_size(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s file size.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_duration(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s duration.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_bitrate(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s bitrate.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_view_count(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s view count.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_description(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s description.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_file_extension(tiz_youtube_t * ap_youtube)

Retrieve the current audio stream’s file extension.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_video_id(tiz_youtube_t * ap_youtube)

Retrieve the current streams video id.

Parameters
  • ap_gmusic: The tiz_youtube handle.

const char* tiz_youtube_get_current_audio_stream_published(tiz_youtube_t * ap_youtube)

Retrieve the current streams upload date and time.

Parameters
  • ap_gmusic: The tiz_youtube handle.

void tiz_youtube_destroy(tiz_youtube_t * ap_youtube)

Destroy the tiz_youtube handle.

Parameters
  • ap_youtube: The tiz_youtube handle.