Graham Walters

A wee site for the things I do

How to Fix Google Play Music not playing in Safari

Chrome has always been my favourite web browser, but I’ve decided to start using Safari as my default browser, until Chrome supports storing passwords in my iCloud keychain. Long story short it doesn’t look like that will be happening any time soon, so I’ve started using Safari more. Today I discovered a problem Google Play Music wouldn’t start playing in Safari. Turns out it’s because of a battery saving feature called Safari Power Saver.

Safari Power Saver conserves battery life by intelligently pausing web videos and other plug‑in content when they’re not front and center on the web pages you visit.

The Debugging:

You can turn off Safari Power Saver, but then we’re back to wasting energy, so instead I came up with a little hack to get Safari to start playing my music. Safari is smart enough to remember which sites have been set to allow flash to start automatically, so all we have to do is get Flash to start once. I attempted playing different types of media to trick Safari into starting Flash, but the way the Google Play website was built, the parts that actually load the media are all out of sight, so I had to come up with a way of changing this.

I started by looking through the HTML source to find where the embed elements were located, and started fiddling with the code to see if I could get the audio to play. After a bit of fiddling I figured out that, if I resized the element from 1px by 1px to something large enough to fill most of the screen, and then clicked on the larger element, the audio would start to play. From there I wrote a simple script to do the resizing automatically from the console.

The Solution:

  1. Open Google Play Music in a new tab.
  2. Click on a song, album, radio to start playing music as you would normally.
  3. Hold down the following keys: [option] + [command] + [C]. A console window should open.
  4. Paste the below code into the console like the images below shows: Safari Console
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    var jq = document.createElement('script');
    jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
    document.getElementsByTagName('head')[0].appendChild(jq);
    // Wait 3 seconds.
    setTimeout(function() {
      jQuery.noConflict();
      jQuery('#embed-container embed').css({
        'height' : '800px',
        'width'  : '800px'
      });
    }, 3000);
    
  5. Wait for a large box to appear on the Google Play page. If this takes longer than 10 seconds, something has probably gone wrong. Restart Safari and go back to step one again.
  6. Click on the large box, once to switch windows and another to start flash, and another for good luck.
  7. Your music should start playing (give it a second or two).
  8. If your music started playing, reload the tab to check your settings saved.
  9. Click on a song to play, and it should just start playing...

Something went wrong — nothing happened!

First lets check if the changes applied:

  1. Open the preferences and navigate to the Advanced tab.
  2. Now look for "Internet plug-ins: Stop plug-ins to save power", and below it there should be a button which says "Details".
  3. Click on the "Details" button, and look for "play.google.com" in the list.
  4. If the button does not exist or "play.google.com" is not in the list, the hack didn't work. Restart Safari and start at step one again.

If you have tried the above instructions multiple times, and your music still isn’t playing, I recommend you take a look at the official support page. If you are receiving any errors in your console after running my code, please copy them into a comment below, and I will have a go at solving your problem.


If this helped you, I’ve written a similar solution for SoundCloud here.

This entry was tagged Google Music Safari