Jump to content

AirPlay Mirroring On/Off


Recommended Posts

This workflow let you activate and deactivate AirPlay Mirroring from Mac to Apple TV via Alfred.
 
The user can choose between keyboard shortcuts or keywords to activate/deactivate AirPlay Mirroring.
 
Air%20ON.png
 
Air%20OFF.png
 
Keywords:
 
AirPlay On = 'air on'
AirPlay Off = 'air off'
 
AirPlay Audio on = 'audio on' (new feature)
Internal Speakers = 'audio off' (new feature)
USB Speakers = 'audio usb'
 
 
 
 
 
 
 
 
 
Dependencies:
 
  • Add Alfred in System Preferences => Accessibility and Security => Privacy (tab) => Accessability (remember to unlock the hanglock in the lower left part of the window to be able to add applications).
  • Mac with support for AirPlay Mirroring
  • Apple TV on the same network
  • Make sure the (network) name of the Apple TV is "Apple TV". If not, look for solutions at the end of this post.
  • If you see the AirPlay icon in the menu bar, you're good to go

If your Apple TV's name's not "Apple TV" - you can make the workflow work by using one of these methods:

 

set valg to "Apple TV"
----------------------------------------------------- ** UPDATES ** ------------------------------------------------- 
 
 
UPDATE 1.10 - new name: "AirPlay On/Off"
 
Changes in version 1.10:
 
It's now possible to also switch the AirPlay Audio on/off, but also to switch to USB speakers.
 
Update 1.11 - Changes:
 
Added possibility to use USB audio device as output - keyword: 'audio usb'
 
I've also made it easier for the users to add their own device - just remove (* and *) in the bottom part of the code. Then you'll add the keyword you want to use, and the name of the audio device as explained in the screenshot below.
 
AirPlay%20onoff.png
 

Update 1.12 - Changes:

 

New option: reset 'coreaudiod' process (useful when system audio or airplay isn't working like it should).

 

How to reset 'coreaudiod' process: Add your own keyboard shortcut in the preferences, or use the keyword "resetair"

 

 

Update 1.13 - Changes:

 

- Bug fixes

- Better support for multiple AirPlay Audio devices...

 

Download AirPlay On/Off v1.13

 

Update 1.2 - Changes:

 

- ready for Yosemite

- bug fixes

Edited by MacGeeky
Link to comment
  • 2 weeks later...

New update: AirPlay On/Off 1.12

 

Changes:

 

 

New option: reset 'coreaudiod' process (useful when system audio or airplay isn't working like it should).

 

How to reset coreaudiod process: Add your own keyboard shortcut in the preferences, or use the keyword "resetair"

Edited by MacGeeky
Link to comment
  • 5 weeks later...

Thanks for the awesome plugin MacGeeky. I had never noticed the sound settings in System Preferences which allow you to select your apple tv for audio output. I tried to do this with your Workflow, I can turn off the audio, but I can't turn it on. Assuming it has do with the "Apple TV" name which has spaces?

 

I tried: 

audio Apple TV

audio "Apple TV"

audio on

 

Any other ideas?

Link to comment

Thanks for the awesome plugin MacGeeky. I had never noticed the sound settings in System Preferences which allow you to select your apple tv for audio output. I tried to do this with your Workflow, I can turn off the audio, but I can't turn it on. Assuming it has do with the "Apple TV" name which has spaces?

 

I tried: 

audio Apple TV

audio "Apple TV"

audio on

 

Any other ideas?

Hi, try to install this version instead... http://cl.ly/Pdex

 

 

 

Please tell me if this works for you or not :)

 

Use 'Audio on'

Edited by MacGeeky
Link to comment
  • 5 months later...
  • 6 months later...

Thanks for the workflow, it's super handy! I wanted to post this in case anyone else has a similar issue. When using keyword 'air on' I was being given a prompt to 'Choose Device' and a choice between my Apple TV as well as "msng". I have no idea what msng is, it does not appear in my options when manually turning on Airplay. But I was able to remove it and avoid the extra prompt by modifying the top Applescript in the workflow like this:

 

(I'm on 10.9 Mavericks if that's helpful)
 

            set enheter to name of menu items of menu 1 of pop up button 1 of window 1 as list
            set enheter2 to items 2 thru (number of items in enheter) of enheter

        -- Beginning of custom code - Remove mysterious msng option
            set itemsToDelete to {"msng"}
            set cleanList to {}
            repeat with i from 1 to count enheter2
                if {enheter2's item i} is not in itemsToDelete then set cleanList's end to enheter2's item i
            end repeat
            set enheter to cleanList
            set enheter2 to cleanList   
	
Edited by maskedjellybean
Link to comment
  • 3 months later...
  • 2 weeks later...

Thank you Mac, this is a fantastic workflow!! Unfortunately I can't seem to get it to work on Yosemite.

 

Is this broken as of Yosemite?

 

Also getting the msng selection but maskedjellybean's solution seems to work (unfortunately I get the same non-functioning error with and without the custom code)

Link to comment

Thank you Mac, this is a fantastic workflow!! Unfortunately I can't seem to get it to work on Yosemite.

 

Is this broken as of Yosemite?

 

Also getting the msng selection but maskedjellybean's solution seems to work (unfortunately I get the same non-functioning error with and without the custom code)

Yes, same here. No function. Get the list wit my Apple TV and a msng entry. If i select the Apple TV, Airplay start, but i have a black screen on the TV. If i start Airplay mirroring manualy everything is fine and works.

 

how could help ?

Link to comment

It´s actually working fine on my Mac with Yosemite, but had to implement the code from @maskedjellybean to get rid of the msng-error.

 

What happens when you use the extension? Nothing at all, or does it just stop somewhere in the process?

 

And last - is Alfred added in the list here: System Preferences => Accessibility and Security => Privacy (tab) => Accessability? If not, please add Alfred and see if that makes any difference. That´s probably the one and only reason people are having problems with this extension on Yosemite!

Edited by MacGeeky
Link to comment

The latest update seems to have successfully removed the msng message I received before, same as adding the custom code did. But it's still not working on yosemite for me (unfortunately I just discovered this workflow so didn't have a chance to test if it worked prior to the upgrade). I'm using the latest 2013 macbook pro retina.

 

Best I can describe on activating the workflow is it pulls up display, shuffles a bit with the menu and clear selects "Apple TV", but then nothing happens.

 

Maybe the delay is too short and somehow canceling the menu before it has time to fully implement?

Link to comment

@Jason588 or anyone else - could you please test this version for me? http://cl.ly/YJES

 

I finally replicated the bug on my Mac after a clean install of Yosemite, and removed it. It should be gone on any Mac running Yosemite, but I have to get it confirmed from other users before I post this version as an "official" update  :)

 

Maybe the delay is too short and somehow canceling the menu before it has time to fully implement?

 

You were absolutely right, thanks! :D

Edited by MacGeeky
Link to comment
  • 3 months later...

I have two Apple TV and I set the value to Apple TV2 and I still get a popup window with 3 entries:  msg, Apple TV1, Apple TV2.  If I select one of of the apple TV's is stil odes not work.  I looked at your code and wee you are trying to strip out msg.  Any ideas?

Link to comment
  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...