add AudioExclusive mode

This commit is contained in:
Drew Weymouth
2023-03-17 18:14:08 -07:00
parent ae4660aa2c
commit 26b3a7f667
3 changed files with 10 additions and 4 deletions
+5 -1
View File
@@ -77,7 +77,7 @@ func NewWithClientName(c string) *Player {
// Initializes the Player and makes it ready for playback.
// Most Player functions will return ErrUnitialized if called before Init.
func (p *Player) Init() error {
func (p *Player) Init(audioExclusive bool) error {
if !p.initialized {
m, err := CreateMPV()
if err != nil {
@@ -96,6 +96,10 @@ func (p *Player) Init() error {
}
m.SetOption("volume", MPVFormatInt64, p.vol)
if audioExclusive {
m.SetOptionString("audio-exclusive", "yes")
}
if p.clientName != "" {
m.SetOptionString("audio-client-name", p.clientName)
}