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

Kodi's player. More...

Modules

 Callback functions from Kodi to Add-On
 Callback functions.
 

Classes

class  XBMCAddon::xbmc::Player
 

Functions

 XBMCAddon::xbmc::Player::play (...)
 Play a item. More...
 
 XBMCAddon::xbmc::Player::stop ()
 
 XBMCAddon::xbmc::Player::pause ()
 
 XBMCAddon::xbmc::Player::playnext ()
 
 XBMCAddon::xbmc::Player::playprevious ()
 
 XBMCAddon::xbmc::Player::playselected (...)
 
 XBMCAddon::xbmc::Player::isPlaying ()
 
 XBMCAddon::xbmc::Player::isPlayingAudio ()
 
 XBMCAddon::xbmc::Player::isPlayingVideo ()
 
 XBMCAddon::xbmc::Player::isPlayingRDS ()
 
 XBMCAddon::xbmc::Player::isExternalPlayer ()
 
 XBMCAddon::xbmc::Player::getPlayingFile ()
 
 XBMCAddon::xbmc::Player::getTime ()
 
 XBMCAddon::xbmc::Player::seekTime (...)
 
 XBMCAddon::xbmc::Player::setSubtitles (...)
 
 XBMCAddon::xbmc::Player::showSubtitles (...)
 
 XBMCAddon::xbmc::Player::getSubtitles ()
 
 XBMCAddon::xbmc::Player::getAvailableSubtitleStreams ()
 
 XBMCAddon::xbmc::Player::setSubtitleStream (...)
 
 XBMCAddon::xbmc::Player::updateInfoTag ()
 
 XBMCAddon::xbmc::Player::getVideoInfoTag ()
 
 XBMCAddon::xbmc::Player::getMusicInfoTag ()
 
 XBMCAddon::xbmc::Player::getRadioRDSInfoTag ()
 
 XBMCAddon::xbmc::Player::getTotalTime ()
 
 XBMCAddon::xbmc::Player::getAvailableAudioStreams ()
 
 XBMCAddon::xbmc::Player::setAudioStream (...)
 
 XBMCAddon::xbmc::Player::getAvailableVideoStreams ()
 
 XBMCAddon::xbmc::Player::setVideoStream (...)
 

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getAvailableAudioStreams() </big></font></span></code></h4> \endhtmlonly

Get Audio stream names

Returns
List of audio streams as name

◆ getAvailableSubtitleStreams()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getAvailableSubtitleStreams() </big></font></span></code></h4> \endhtmlonly

Get Subtitle stream names.

Returns
List of subtitle streams as name

◆ getAvailableVideoStreams()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getAvailableVideoStreams() </big></font></span></code></h4> \endhtmlonly

Get Video stream names

Returns
List of video streams as name

◆ getMusicInfoTag()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getMusicInfoTag() </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getPlayingFile() </big></font></span></code></h4> \endhtmlonly

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.

◆ getRadioRDSInfoTag()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getRadioRDSInfoTag() </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getSubtitles() </big></font></span></code></h4> \endhtmlonly

Get subtitle stream name.

Returns
Stream name

◆ getTime()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getTime() </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getTotalTime() </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getVideoInfoTag() </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isExternalPlayer() </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isPlaying() </big></font></span></code></h4> \endhtmlonly

Check Kodi is playing something.

Returns
True if Kodi is playing a file.

◆ isPlayingAudio()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isPlayingAudio() </big></font></span></code></h4> \endhtmlonly

Check for playing audio.

Returns
True if Kodi is playing an audio file.

◆ isPlayingRDS()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isPlayingRDS() </big></font></span></code></h4> \endhtmlonly

Check for playing radio data system (RDS).

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

◆ isPlayingVideo()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isPlayingVideo() </big></font></span></code></h4> \endhtmlonly

Check for playing video.

Returns
True if Kodi is playing a video.

◆ pause()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> pause() </big></font></span></code></h4> \endhtmlonly

Pause or resume playing if already paused.

◆ play()

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

Play a item.

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> play([item, listitem, windowed, startpos]) </big></font></span></code></h4> \endhtmlonly

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 ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> playnext() </big></font></span></code></h4> \endhtmlonly

Play next item in playlist.

◆ playprevious()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> playprevious() </big></font></span></code></h4> \endhtmlonly

Play previous item in playlist.

◆ playselected()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> playselected(selected) </big></font></span></code></h4> \endhtmlonly

Play a certain item from the current playlist.

Parameters
selectedInteger - Item to select

◆ seekTime()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> seekTime(seekTime) </big></font></span></code></h4> \endhtmlonly

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setAudioStream(stream) </big></font></span></code></h4> \endhtmlonly

Set Audio Stream.

Parameters
iStream[int] Audio stream to select for play

Example:

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

◆ setSubtitles()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setSubtitles(subtitleFile) </big></font></span></code></h4> \endhtmlonly

Set subtitle file and enable subtitles.

Parameters
subtitleFileFile to use as source ofsubtitles

◆ setSubtitleStream()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setSubtitleStream(stream) </big></font></span></code></h4> \endhtmlonly

Set Subtitle Stream.

Parameters
iStream[int] Subtitle stream to select for play

Example:

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

◆ setVideoStream()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setVideoStream(stream) </big></font></span></code></h4> \endhtmlonly

Set Video Stream.

Parameters
iStream[int] Video stream to select for play

Example:

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

◆ showSubtitles()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> showSubtitles(visible) </big></font></span></code></h4> \endhtmlonly

Enable / disable subtitles.

Parameters
visible[boolean] True for visible subtitles.

Example:

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

◆ stop()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> stop() </big></font></span></code></h4> \endhtmlonly

Stop playing.

◆ updateInfoTag()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> updateInfoTag(item) </big></font></span></code></h4> \endhtmlonly

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