It's possible and sounds the same as a direct connection. However, it may be simpler and cheaper to buy a switch. For example: Amazon.com: 4 Port Toslink Switch, Portta 4x1 SPDIF Optical Digital Audio Switcher Box with IR Remote Control for Apple TV, PS4, Xbox, Blu-ray Player, Sound Bar...