Mac book pro error: Could not connect to “apple tv”
I have a MacBook Pro Retina, 15-inch Mid 2012 running OSX Yosemite 10.10.5.
It used to run Airplay on my Apple TV and recently, that stopped working. The Airplay link appears on top of my screen and is disconnected at all times. When I am in the Displays Preferences window, I cannot switch the button from "off" to "Apple TV". It reverses automatically to "off" without any action from me and I am getting a message that says "could not connect to Apple TV".
I tried Airplay on AppleTV from my Iphone5S and it works just fine so this is linked to Mac.
Is there anyone who could help?
MacBook Pro (Retina, Mid 2012), OS X Yosemite (10.10.3)