Kodi Documentation  20.0
Kodi is an open source media player and entertainment hub.

Kodi's player. More...

Collaboration diagram for Player:

Modules

 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. More...
 
 XBMCAddon::xbmc::Player::stop ()
 

Function: stop()


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

Function: pause()


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

Function: playnext()


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

Function: playprevious()


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

Function: playselected(selected)


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

Function: isPlaying()


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

Function: isPlayingAudio()


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

Function: isPlayingVideo()


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

Function: isPlayingRDS()


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

Function: isExternalPlayer()


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

Function: getPlayingFile()


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

Function: getPlayingItem()



Returns the current playing item. More...

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

Function: getTime()


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

Function: seekTime(seekTime)


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

Function: setSubtitles(subtitleFile)


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

Function: showSubtitles(visible)


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

Function: getSubtitles()


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

Function: getAvailableSubtitleStreams()


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

Function: setSubtitleStream(stream)


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

Function: updateInfoTag(item)


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

Function: getVideoInfoTag()


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

Function: getMusicInfoTag()


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

Function: getRadioRDSInfoTag()


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

Function: getTotalTime()


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

Function: getAvailableAudioStreams()


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

Function: setAudioStream(stream)


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

Function: getAvailableVideoStreams()


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

Function: setVideoStream(stream)


Set Video Stream. More...
 

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

◆ 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.

◆ 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)
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)
...