ivy-youtube icon indicating copy to clipboard operation
ivy-youtube copied to clipboard

Large output buffer causes mpv to freeze for sometime

Open Gleek opened this issue 2 years ago • 1 comments

Hello,

Thank you for sharing this package. I'm facing a issue in playing videos through mpv where the mpv player stops responding after playing a certain length of video. I initially thought this to be a bug in mpv, but I could only replicate it by running it via ivy-youtube. Running it on a shell doesn't cause issues.

I think I'm able to figure out the reason here.

The default command to run the process:

(make-process :name "Ivy Youtube"
                :buffer "*Ivy Youtube Output*"
                :sentinel (lambda (process event)
                            (message
                             (format "Ivy Youtube: Process %s (Check buffer *Ivy Youtube Output*)" event)))
                :command `(,ivy-youtube-play-at ,video-url))

Causes a lot of output to be written in the *Ivy Youtube Output* buffer consider the shell escape characters aren't correctly processed. Removing the buffer and sentinel stops that from happening.

I would suggest we move these behind a debug flag that is switched off by default.

Gleek avatar May 13 '22 10:05 Gleek

Update: This also didn't work. Seems that emacs being out of focus on a macOS is somehow causing the issue. Anyways, I think the issue is out of this project's scope if that's the case and can be closed.

I had to finally use dtache to get it to work correctly.

Below is the code if someone's interested:

(defun ivy-youtube-play-on-process-a(video-url)
    (require 'dtache)
    (dtache-start-session (concat ivy-youtube-play-at " " (shell-quote-argument video-url)) t))

(advice-add 'ivy-youtube-play-on-process :override 'ivy-youtube-play-on-process-a)

Gleek avatar May 13 '22 13:05 Gleek