Skip to content

Commit

Permalink
fix mpv playback
Browse files Browse the repository at this point in the history
  • Loading branch information
5rahim committed May 20, 2024
1 parent 399fc25 commit 8d49e3b
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions internal/mediaplayers/mpv/mpv.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mpv
import (
"context"
"errors"
"fmt"
"github.com/jannson/mpvipc"
"github.com/rs/zerolog"
"os/exec"
Expand Down Expand Up @@ -342,32 +341,32 @@ func (s *Subscriber) Done() chan struct{} {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// getDefaultSocketName returns the default name of the socket/pipe.
//func getDefaultSocketName() string {
// switch runtime.GOOS {
// case "windows":
// return "\\\\.\\pipe\\mpv_ipc"
// case "linux":
// return "/tmp/mpv_socket"
// case "darwin":
// return "/tmp/mpv_socket"
// default:
// return "/tmp/mpv_socket"
// }
//}

func getDefaultSocketName() string {
switch runtime.GOOS {
case "windows":
return fmt.Sprintf("\\\\.\\pipe\\mpv_ipc_%d", time.Now().UnixNano())
return "\\\\.\\pipe\\mpv_ipc"
case "linux":
return fmt.Sprintf("/tmp/mpv_socket_%d", time.Now().UnixNano())
return "/tmp/mpv_socket"
case "darwin":
return fmt.Sprintf("/tmp/mpv_socket_%d", time.Now().UnixNano())
return "/tmp/mpv_socket"
default:
return fmt.Sprintf("/tmp/mpv_socket_%d", time.Now().UnixNano())
return "/tmp/mpv_socket"
}
}

//func getDefaultSocketName() string {
// switch runtime.GOOS {
// case "windows":
// return fmt.Sprintf("\\\\.\\pipe\\mpv_ipc_%d", time.Now().UnixNano())
// case "linux":
// return fmt.Sprintf("/tmp/mpv_socket_%d", time.Now().UnixNano())
// case "darwin":
// return fmt.Sprintf("/tmp/mpv_socket_%d", time.Now().UnixNano())
// default:
// return fmt.Sprintf("/tmp/mpv_socket_%d", time.Now().UnixNano())
// }
//}

// createCmd returns a new exec.Cmd instance.
func (m *Mpv) createCmd(filePath string, args ...string) (*exec.Cmd, error) {
var cmd *exec.Cmd
Expand Down

0 comments on commit 8d49e3b

Please sign in to comment.