I have the Plex Media Server running on my 27″ iMac Desktop System, and stream videos stored on my Mac to my Android Tablet through my home WiFi system. I usually do this at night while in bed, watching a TV show or part of a movie just before I go to sleep. I noticed a few months ago that while I was watching a streaming video, it would routinely just stop and hang. Pressing the pause button with the video player app on my tablet and then the play button would only play the video segment for about 2-3 seconds before it halted again.
Thinking this problem might be with the video player, I tried a few others available for my Android tablet– same thing happened. I also tried using a different media server as a test, switching from Plex to Universal Media Server but I still got the same stoppage of video playing.
After some Googling, I discovered that my iMac Desktop system might be going into sleep mode and possibly shutting down my WiFi connection. However, under my Mac’s Preferences for “Energy Saver” it was set to never sleep for the computer and for the display to sleep after 45 minutes. Hmm, maybe the sleeping display setting did more than just turn off the display?
Well, something was stopping or preventing my media from streaming from my Mac, so I tried using a OSX command called caffinate to keep my Mac alive and awake when I was in bed watching my streaming videos. To do so, you would type in the UNIX command in a Terminal window,
caffeinate -t 10800
Here, I’m telling my Mac to stay awake for 10,800 seconds (3 hrs) beginning when I initiated that command. Since I wanted this command to happen automatically everyday at 9 pm, I added it to the Crontab file on my system (Crontab was actually replaced by a process called launchd on the Mac OSX, but you can still use crontab settings). To make this change easier, I used a GUI called CronniX which looks like this,
Here you see that I’m having that command start at 21 hours (9:00 pm) and it occurs everyday. The “&” symbol at the end of the command statement had the process running in the background. So far, this seems to have fixed my streaming video stoppage, so hopefully this is a permanent solution to my problem.