Playing a remote movie on the remote computer

13,365

Solution 1

All you have to do is set your $DISPLAY in your ssh session to match your desktop's display.

You could echo $DISPLAY from a terminal on the desktop, and then export $DISPLAY="what above said" in your ssh session.

Solution 2

Linux manages sound and display differently. You normally only get access to the screen if you've logged in locally, whereas sound is often available to all processes running on the system.

A GUI program knows where to display from the DISPLAY environment variable. That variable tells it which X server to contact. If one user is logged in locally on a machine, the display is normally :0. So in your ssh session, run

export DISPLAY=:0
mplayer /path/to/movie.mpg

Depending on your system's configuration, you may need to set XAUTHORITY as well.

Share:
13,365

Related videos on Youtube

pepper
Author by

pepper

Updated on September 18, 2022

Comments

  • pepper
    pepper almost 2 years

    I have two computers (a desktop and a laptop) running linux connected to my local area network. I like to ssh from my laptop over to my desktop and run programs there, and sometimes listen to music on my desktop, which is connected to my stereo system. Lately, I've been wanting to play movies on the desktop and desktop screen, but cue them from my laptop across the room.

    Unfortunately, I cannot play a movie in the current X session running on my Desktop on from my laptop. What is odd about this is that I can listen to the audio coming from the speakers that are hooked up to my desktop, by playing the audio files over ssh! This tells me that there must be a way to send the movie to that Xsession, from the ssh shell that I am connected to.

    Does anyone have any ideas about this?

  • Jeff Hewitt
    Jeff Hewitt about 11 years
    You may also want to ensure that remote hosts are granted X authority via xhost + or xhost +<laptop_hostname> to be more secure.
  • pepper
    pepper about 11 years
    is there something similar to the $DISPLAY env variable, but for audio? For instance, if I wanted to ensure that a sound was not forwarded to my local computer...
  • demure
    demure about 11 years
    Sound will not be forwarded, unless you go to some effort intentionally.
  • Kota Mori
    Kota Mori about 3 years
    Isn't this supposed to be export DISPLAY=...? I mean, no "$" before DISPLAY. That way worked to me, thanks!