Yes, soundbars can be used to play music from your smartphone, tablet or other devices via Bluetooth or other connections.
How do I connect the soundbar to my TV?
You can connect the soundbar via HDMI ARC, optical cable, Bluetooth or even via an AUX cable, depending on the ports available on the TV and the soundbar.