Kodi's player.
Class: xbmc.Player()
To become and create the class to play something.
Example:
...
xbmc.Player().play(url, listitem, windowed)
...
◆ 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)
...
◆ stop()
Function: stop()
Stop playing.
◆ pause()
Function: pause()
Pause or resume playing if already paused.
◆ playnext()
Function: playnext()
Play next item in playlist.
◆ playprevious()
Function: playprevious()
Play previous item in playlist.
◆ playselected()
Function: playselected(selected)
Play a certain item from the current playlist.
- Parameters
-
selected | Integer - Item to select |
◆ isPlaying()
Function: isPlaying()
Check Kodi is playing something.
- Returns
- True if Kodi is playing a file.
◆ isPlayingAudio()
Function: isPlayingAudio()
Check for playing audio.
- Returns
- True if Kodi is playing an audio file.
◆ isPlayingVideo()
Function: isPlayingVideo()
Check for playing video.
- Returns
- True if Kodi is playing a video.
◆ isPlayingRDS()
Function: isPlayingRDS()
Check for playing radio data system (RDS).
- Returns
- True if kodi is playing a radio data system (RDS).
◆ isExternalPlayer()
Function: isExternalPlayer()
Check for external player.
- Returns
- True if kodi is playing using an external player.
- v18 Python API changes:
- New function added.
◆ 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
-
Exception | If player is not playing a file. |
◆ getPlayingItem()
Function: getPlayingItem()
Returns the current playing item.
- Returns
- Playing item
- Exceptions
-
Exception | If player is not playing a file. |
- v20 Python API changes:
- New function added.
◆ 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
-
Exception | If player is not playing a file. |
◆ 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
-
seekTime | Time to seek as fractional seconds |
- Exceptions
-
Exception | If player is not playing a file. |
◆ setSubtitles()
Function: setSubtitles(subtitleFile)
Set subtitle file and enable subtitles.
- Parameters
-
subtitleFile | File to use as source ofsubtitles |
◆ showSubtitles()
Function: showSubtitles(visible)
Enable / disable subtitles.
- Parameters
-
visible | [boolean] True for visible subtitles. |
Example:
...
xbmc.Player().showSubtitles(True)
...
◆ getSubtitles()
Function: getSubtitles()
Get subtitle stream name.
- Returns
- Stream name
◆ getAvailableSubtitleStreams()
getAvailableSubtitleStreams |
( |
| ) |
|
Function: getAvailableSubtitleStreams()
Get Subtitle stream names.
- Returns
- List of subtitle streams as name
◆ setSubtitleStream()
Function: setSubtitleStream(stream)
Set Subtitle Stream.
- Parameters
-
iStream | [int] Subtitle stream to select for play |
Example:
...
xbmc.Player().setSubtitleStream(1)
...
◆ updateInfoTag()
Function: updateInfoTag(item)
Update info labels for currently playing item.
- Parameters
-
item | ListItem with new info |
- Exceptions
-
Exception | If 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)
...
◆ getVideoInfoTag()
Function: getVideoInfoTag()
To get video info tag.
Returns the VideoInfoTag of the current playing Movie.
- Returns
- Video info tag
- Exceptions
-
Exception | If player is not playing a file or current file is not a movie file. |
◆ getMusicInfoTag()
Function: getMusicInfoTag()
To get music info tag.
Returns the MusicInfoTag of the current playing 'Song'.
- Returns
- Music info tag
- Exceptions
-
Exception | If player is not playing a file or current file is not a music file. |
◆ 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
-
Exception | If player is not playing a file or current file is not a rds file. |
◆ 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
-
Exception | If player is not playing a file. |
◆ getAvailableAudioStreams()
getAvailableAudioStreams |
( |
| ) |
|
Function: getAvailableAudioStreams()
Get Audio stream names
- Returns
- List of audio streams as name
◆ setAudioStream()
Function: setAudioStream(stream)
Set Audio Stream.
- Parameters
-
iStream | [int] Audio stream to select for play |
Example:
...
xbmc.Player().setAudioStream(1)
...
◆ getAvailableVideoStreams()
getAvailableVideoStreams |
( |
| ) |
|
Function: getAvailableVideoStreams()
Get Video stream names
- Returns
- List of video streams as name
◆ setVideoStream()
Function: setVideoStream(stream)
Set Video Stream.
- Parameters
-
iStream | [int] Video stream to select for play |
Example:
...
xbmc.Player().setVideoStream(1)
...