mpris

package
v0.0.0-...-a1b9eeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBusPath      = "org.mpris.MediaPlayer2"
	DBusInterface = "/org/mpris/MediaPlayer2"
)

Variables

This section is empty.

Functions

func Discover

func Discover() ([]string, error)

Discover returns MPRIS players available.

Types

type MediaMetadata

type MediaMetadata map[string]dbus.Variant

MediaMetadata is a mapping from metadata attribute names to values.

https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/

func (MediaMetadata) ImageURL

func (m MediaMetadata) ImageURL() *url.URL

ImageURL returns the URL of the image.

func (MediaMetadata) MediaDuration

func (m MediaMetadata) MediaDuration() time.Duration

MediaDuration returns the duration of the media.

func (MediaMetadata) MediaURL

func (m MediaMetadata) MediaURL() *url.URL

MediaURL returns the URL of the media content.

func (MediaMetadata) Subtitle

func (m MediaMetadata) Subtitle() string

Subtitle returns the descriptive subtitle of the content. Usually, the name of the album.

func (MediaMetadata) Title

func (m MediaMetadata) Title() string

Title returns the descriptive title of the content.

func (MediaMetadata) TrackID

func (m MediaMetadata) TrackID() dbus.ObjectPath

TrackID returns the track ID as a D-Bus object path.

type Player

type Player struct {
	// contains filtered or unexported fields
}

Player represents a MPRIS player.

func NewPlayer

func NewPlayer(dest string) (*Player, error)

NewPlayer returns a new player.

func (*Player) IsBuffering

func (p *Player) IsBuffering() bool

IsBuffering always returns false as the MPRIS API does not provide this information.

func (*Player) IsIdle

func (p *Player) IsIdle() bool

IsIdle returns true if the media playback stopped.

func (*Player) IsMuted

func (p *Player) IsMuted() bool

IsMuted returns true if the receiver is muted.

func (*Player) IsPaused

func (p *Player) IsPaused() bool

IsPaused returns true if playback is paused.

func (*Player) IsPlaying

func (p *Player) IsPlaying() bool

IsPlaying returns true if the player is actively playing content.

func (*Player) Load

func (p *Player) Load(media *url.URL, metadata omnicast.MediaMetadata) error

Load opens media and starts playback.

func (*Player) MediaDuration

func (p *Player) MediaDuration() time.Duration

MediaDuration returns the duration of current loaded media.

func (*Player) MediaMetadata

func (p *Player) MediaMetadata() omnicast.MediaMetadata

MediaMetadata returns the metadata of current loaded media.

func (*Player) MediaURL

func (p *Player) MediaURL() *url.URL

MediaURL returns the URL of current loaded media.

func (*Player) Mute

func (p *Player) Mute()

Mute mutes the receiver.

func (*Player) Name

func (p *Player) Name() string

Name returns the name of the player instace.

func (*Player) Pause

func (p *Player) Pause()

Pause pauses playback of the current content.

func (*Player) Play

func (p *Player) Play()

Play starts or resumes playback.

func (*Player) PlaybackPosition

func (p *Player) PlaybackPosition() time.Duration

PlaybackPosition returns the current position of media playback from the beginning of media content.

func (*Player) PlaybackRate

func (p *Player) PlaybackRate() float32

PlaybackRate returns the ratio of speed that media is played at.

func (*Player) PlaybackStatus

func (p *Player) PlaybackStatus() string

PlaybackStatus return the current playback status.

func (*Player) SeekTo

func (p *Player) SeekTo(pos time.Duration)

SeekTo sets the current playback position to pos.

func (*Player) SetVolumeLevel

func (p *Player) SetVolumeLevel(level float64)

SetVolumeLevel sets receiver volume level.

func (*Player) Stop

func (p *Player) Stop()

Stop stops the playback and resets the playback position.

func (*Player) Unmute

func (p *Player) Unmute()

Unmute unmutes the receiver.

func (*Player) VolumeLevel

func (p *Player) VolumeLevel() float64

VolumeLevel returns receiver volume as a number between 0.0 and 1.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL