Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches

Kodi's player. More...

Topics

 Callback functions from Kodi to Add-On
 Callback functions.
 

Classes

class  XBMCAddon::xbmc::Player
 

Functions

 XBMCAddon::xbmc::Player::play (...)
 

Function: play([item, listitem, windowed, startpos])


Play an item.
 
 XBMCAddon::xbmc::Player::stop ()
 

Function: stop()


Stop playing.
 
 XBMCAddon::xbmc::Player::pause ()
 

Function: pause()


Pause or resume playing if already paused.
 
 XBMCAddon::xbmc::Player::playnext ()
 

Function: playnext()


Play next item in playlist.
 
 XBMCAddon::xbmc::Player::playprevious ()
 

Function: playprevious()


Play previous item in playlist.
 
 XBMCAddon::xbmc::Player::playselected (...)
 

Function: playselected(selected)


Play a certain item from the current playlist.
 
 XBMCAddon::xbmc::Player::isPlaying ()
 

Function: isPlaying()


Check Kodi is playing something.
 
 XBMCAddon::xbmc::Player::isPlayingAudio ()
 

Function: isPlayingAudio()


Check for playing audio.
 
 XBMCAddon::xbmc::Player::isPlayingVideo ()
 

Function: isPlayingVideo()


Check for playing video.
 
 XBMCAddon::xbmc::Player::isPlayingRDS ()
 

Function: isPlayingRDS()


Check for playing radio data system (RDS).
 
 XBMCAddon::xbmc::Player::isPlayingGame ()
 

Function: isPlayingGame()


Check for playing game.
 
 XBMCAddon::xbmc::Player::isExternalPlayer ()
 

Function: isExternalPlayer()


Check for external player.
 
 XBMCAddon::xbmc::Player::getPlayingFile ()
 

Function: getPlayingFile()


Returns the current playing file as a string.
 
 XBMCAddon::xbmc::Player::getPlayingItem ()
 

Function: getPlayingItem()


Returns the current playing item.
 
 XBMCAddon::xbmc::Player::getTime ()
 

Function: getTime()


Get playing time.
 
 XBMCAddon::xbmc::Player::seekTime (...)
 

Function: seekTime(seekTime)


Seek time.
 
 XBMCAddon::xbmc::Player::setSubtitles (...)
 

Function: setSubtitles(subtitleFile)


Set subtitle file and enable subtitles.
 
 XBMCAddon::xbmc::Player::showSubtitles (...)
 

Function: showSubtitles(visible)


Enable / disable subtitles.
 
 XBMCAddon::xbmc::Player::getSubtitles ()
 

Function: getSubtitles()


Get subtitle stream name.
 
 XBMCAddon::xbmc::Player::getAvailableSubtitleStreams ()
 

Function: getAvailableSubtitleStreams()


Get Subtitle stream names.
 
 XBMCAddon::xbmc::Player::setSubtitleStream (...)
 

Function: setSubtitleStream(stream)


Set Subtitle Stream.
 
 XBMCAddon::xbmc::Player::updateInfoTag ()
 

Function: updateInfoTag(item)


Update info labels for currently playing item.
 
 XBMCAddon::xbmc::Player::getGameInfoTag ()
 

Function: getGameInfoTag()


To get game info tag.
 
 XBMCAddon::xbmc::Player::getVideoInfoTag ()
 

Function: getVideoInfoTag()


To get video info tag.
 
 XBMCAddon::xbmc::Player::getMusicInfoTag ()
 

Function: getMusicInfoTag()


To get music info tag.
 
 XBMCAddon::xbmc::Player::getRadioRDSInfoTag ()
 

Function: getRadioRDSInfoTag()


To get Radio RDS info tag
 
 XBMCAddon::xbmc::Player::getTotalTime ()
 

Function: getTotalTime()


To get total playing time.
 
 XBMCAddon::xbmc::Player::getAvailableAudioStreams ()
 

Function: getAvailableAudioStreams()


Get Audio stream names
 
 XBMCAddon::xbmc::Player::setAudioStream (...)
 

Function: setAudioStream(stream)


Set Audio Stream.
 
 XBMCAddon::xbmc::Player::getAvailableVideoStreams ()
 

Function: getAvailableVideoStreams()


Get Video stream names
 
 XBMCAddon::xbmc::Player::setVideoStream (...)
 

Function: setVideoStream(stream)


Set Video Stream.
 

Detailed Description

Kodi's player.

Class: xbmc.Player()

To become and create the class to play something.


Example:

...
xbmc.Player().play(url, listitem, windowed)
...

Function Documentation

◆ getAvailableAudioStreams()

std::vector< String > XBMCAddon::xbmc::Player::getAvailableAudioStreams ( )

Function: getAvailableAudioStreams()


Get Audio stream names

Returns
List of audio streams as name

◆ getAvailableSubtitleStreams()

std::vector< String > XBMCAddon::xbmc::Player::getAvailableSubtitleStreams ( )

Function: getAvailableSubtitleStreams()


Get Subtitle stream names.

Returns
List of subtitle streams as name

◆ getAvailableVideoStreams()

std::vector< String > XBMCAddon::xbmc::Player::getAvailableVideoStreams ( )

Function: getAvailableVideoStreams()


Get Video stream names

Returns
List of video streams as name

◆ getGameInfoTag()

InfoTagGame * XBMCAddon::xbmc::Player::getGameInfoTag ( )

Function: getGameInfoTag()


To get game info tag.

Returns the GameInfoTag of the current playing game.

Returns
Game info tag
Exceptions
ExceptionIf player is not playing a file or current file is not a game file.

v20 Python API changes
New function added.

◆ getMusicInfoTag()

InfoTagMusic * XBMCAddon::xbmc::Player::getMusicInfoTag ( )

Function: getMusicInfoTag()


To get music info tag.

Returns the MusicInfoTag of the current playing 'Song'.

Returns
Music info tag
Exceptions
ExceptionIf player is not playing a file or current file is not a music file.

◆ getPlayingFile()

String XBMCAddon::xbmc::Player::getPlayingFile ( )

Function: getPlayingFile()


Returns the current playing file as a string.

Note
For LiveTV, returns a pvr:// url which is not translatable to an OS specific file or external url.
Returns
Playing filename
Exceptions
ExceptionIf player is not playing a file.

◆ getPlayingItem()

XBMCAddon::xbmcgui::ListItem * XBMCAddon::xbmc::Player::getPlayingItem ( )

Function: getPlayingItem()


Returns the current playing item.

Returns
Playing item
Exceptions
ExceptionIf player is not playing a file.

v20 Python API changes
New function added.

◆ getRadioRDSInfoTag()

InfoTagRadioRDS * XBMCAddon::xbmc::Player::getRadioRDSInfoTag ( )

Function: getRadioRDSInfoTag()


To get Radio RDS info tag

Returns the RadioRDSInfoTag of the current playing 'Radio Song if. present'.

Returns
Radio RDS info tag
Exceptions
ExceptionIf player is not playing a file or current file is not a rds file.

◆ getSubtitles()

String XBMCAddon::xbmc::Player::getSubtitles ( )

Function: getSubtitles()


Get subtitle stream name.

Returns
Stream name

◆ getTime()

double XBMCAddon::xbmc::Player::getTime ( )

Function: getTime()


Get playing time.

Returns the current time of the current playing media as fractional seconds.

Returns
Current time as fractional seconds
Exceptions
ExceptionIf player is not playing a file.

◆ getTotalTime()

double XBMCAddon::xbmc::Player::getTotalTime ( )

Function: getTotalTime()


To get total playing time.

Returns the total time of the current playing media in seconds. This is only accurate to the full second.

Returns
Total time of the current playing media
Exceptions
ExceptionIf player is not playing a file.

◆ getVideoInfoTag()

InfoTagVideo * XBMCAddon::xbmc::Player::getVideoInfoTag ( )

Function: getVideoInfoTag()


To get video info tag.

Returns the VideoInfoTag of the current playing Movie.

Returns
Video info tag
Exceptions
ExceptionIf player is not playing a file or current file is not a movie file.

◆ isExternalPlayer()

bool XBMCAddon::xbmc::Player::isExternalPlayer ( )

Function: isExternalPlayer()


Check for external player.

Returns
True if kodi is playing using an external player.

v18 Python API changes
New function added.

◆ isPlaying()

bool XBMCAddon::xbmc::Player::isPlaying ( )

Function: isPlaying()


Check Kodi is playing something.

Returns
True if Kodi is playing a file.

◆ isPlayingAudio()

bool XBMCAddon::xbmc::Player::isPlayingAudio ( )

Function: isPlayingAudio()


Check for playing audio.

Returns
True if Kodi is playing an audio file.

◆ isPlayingGame()

bool XBMCAddon::xbmc::Player::isPlayingGame ( )

Function: isPlayingGame()


Check for playing game.

Returns
True if kodi is playing a game

v20 Python API changes
New function added.

◆ isPlayingRDS()

bool XBMCAddon::xbmc::Player::isPlayingRDS ( )

Function: isPlayingRDS()


Check for playing radio data system (RDS).

Returns
True if kodi is playing a radio data system (RDS).

◆ isPlayingVideo()

bool XBMCAddon::xbmc::Player::isPlayingVideo ( )

Function: isPlayingVideo()


Check for playing video.

Returns
True if Kodi is playing a video.

◆ pause()

void XBMCAddon::xbmc::Player::pause ( )

Function: pause()


Pause or resume playing if already paused.

◆ play()

void XBMCAddon::xbmc::Player::play ( ...)

Function: play([item, listitem, windowed, startpos])


Play an item.

Parameters
item[opt] string - filename, url or playlist
listitem[opt] listitem - used with setInfo() to set different infolabels.
windowed[opt] bool - true=play video windowed, false=play users preference.(default)
If playback is started windowed refresh rate switch (resolution update) is ignored. This might be useful if you are designing your own player window and want to avoid other GUI elements popping up on screen.
startpos[opt] int - starting position when playing a playlist. Default = -1
Note
If item is not given then the Player will try to play the current item in the current playlist.

You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.

Example:

...
listitem = xbmcgui.ListItem('Ironman')
listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
xbmc.Player().play(url, listitem, windowed)
xbmc.Player().play(playlist, listitem, windowed, startpos)
...

◆ playnext()

void XBMCAddon::xbmc::Player::playnext ( )

Function: playnext()


Play next item in playlist.

◆ playprevious()

void XBMCAddon::xbmc::Player::playprevious ( )

Function: playprevious()


Play previous item in playlist.

◆ playselected()

void XBMCAddon::xbmc::Player::playselected ( ...)

Function: playselected(selected)


Play a certain item from the current playlist.

Parameters
selectedInteger - Item to select

◆ seekTime()

void XBMCAddon::xbmc::Player::seekTime ( ...)

Function: seekTime(seekTime)


Seek time.

Seeks the specified amount of time as fractional seconds. The time specified is relative to the beginning of the currently. playing media file.

Parameters
seekTimeTime to seek as fractional seconds
Exceptions
ExceptionIf player is not playing a file.

◆ setAudioStream()

void XBMCAddon::xbmc::Player::setAudioStream ( ...)

Function: setAudioStream(stream)


Set Audio Stream.

Parameters
iStream[int] Audio stream to select for play

Example:

...
xbmc.Player().setAudioStream(1)
...

◆ setSubtitles()

void XBMCAddon::xbmc::Player::setSubtitles ( ...)

Function: setSubtitles(subtitleFile)


Set subtitle file and enable subtitles.

Parameters
subtitleFileFile to use as source ofsubtitles

◆ setSubtitleStream()

void XBMCAddon::xbmc::Player::setSubtitleStream ( ...)

Function: setSubtitleStream(stream)


Set Subtitle Stream.

Parameters
iStream[int] Subtitle stream to select for play

Example:

...
xbmc.Player().setSubtitleStream(1)
...

◆ setVideoStream()

void XBMCAddon::xbmc::Player::setVideoStream ( ...)

Function: setVideoStream(stream)


Set Video Stream.

Parameters
iStream[int] Video stream to select for play

Example:

...
xbmc.Player().setVideoStream(1)
...

◆ showSubtitles()

void XBMCAddon::xbmc::Player::showSubtitles ( ...)

Function: showSubtitles(visible)


Enable / disable subtitles.

Parameters
visible[boolean] True for visible subtitles.

Example:

...
xbmc.Player().showSubtitles(True)
...

◆ stop()

void XBMCAddon::xbmc::Player::stop ( )

Function: stop()


Stop playing.

◆ updateInfoTag()

void XBMCAddon::xbmc::Player::updateInfoTag ( )

Function: updateInfoTag(item)


Update info labels for currently playing item.

Parameters
itemListItem with new info
Exceptions
ExceptionIf player is not playing a file
v18 Python API changes
New function added.

Example:

...
item = xbmcgui.ListItem()
item.setPath(xbmc.Player().getPlayingFile())
item.setInfo('music', {'title' : 'foo', 'artist' : 'bar'})
xbmc.Player().updateInfoTag(item)
...