The question is very broad, but you can leave some basic concepts and practices. Most of these apps are connected to platforms or Apis that are in the cloud and what you see on your phone screen or on TV are just clients that communicate with the same API on the server or with Apis that communicate with each other.
Most of the time you’re not transmitting content from one device to another, but sending the information to a service that you want to watch certain content on a particular device. Because this platform knows where you are with the application open it can send the command to start playback on the selected device.
But it is also possible, in fact, to broadcast from one device to another through protocols such as DLNA which is supported by many TV sets, Mobiles, Tablets and etc. (practically, if it is a media production device and connects to a network via ethernet, probably supports DLNA
. There are several libraries that implement or attempt to implement the API of this protocol. (examples)
There are also several other ways to address the issue, such as through Kodi, which is the successor of XMBC
.
Hello! See if this link helps: Programming for Chromecast
– eliangela