I think you’re over complicating this. First, most TVs don’t have an optical input, only an optical output. I suspect that what’s happening is that for whatever reason, the HDMI CEC command that defines acceptable formats is either not being sent by the TV, or possibly not being accepted and processed by the Android TV box.
I would recommend a few things. First, go in to the TV’s settings, and make sure HDMI CEC is turned on. That may be called AnyNet + on a Samsung, I think. Then, go into the settings for this Android TV box, and check for similar settings, turning on HDMI CEC. If there is no such setting, restrict the Android TV box to Dolby Digital only, so it doesn’t send signals to your TV that can’t be passed on to the Beam, like Dolby Digital Plus, or DTS.
I think that should clear up your issue. If not, I’d recommend getting in touch with the maker of this Android TV box, and ask them why it isn’t respecting HDMI CEC connections.
Many thanks for your reply. I checked on the tv that AnyNet+ was turned on (it was). Then I went into the android box settings and found CEC Switch which was turned off. I turned it on and hey presto it worked.
Now I am getting the sound from the android box through the Sonos.
very much appreciated ,many thanks
Graham