Show whatever’s on your iMac on the big screen using AirPlay screen mirroring. To mirror the iMac screen on your TV screen or to use the HDTV as a second display, connect your HDTV to Apple TV and make sure the Apple TV is on the same Wi-Fi network as your iMac. You can also play web videos directly on your HDTV without showing what’s on your desktop—handy when you want to play a movie but keep your work private.
In some cases, you can use an AirPlay display even if you’re not on the same Wi-Fi network as Apple TV (called peer-to-peer AirPlay). To use peer-to-peer AirPlay, you need an Apple TV (3rd generation rev A, model A1469 or later) with tvOS 7.0 or later.
Play web videos without showing your desktop. When you find a web video with an AirPlay icon Use AirPlay to stream what’s on your Mac to an HDTV in the macOS User Guide. To learn more about using a second display with your iMac, see If AirPlay or screen mirroring isn’t working on your device.