Play sound through earpiece speaker iphone
This is currently not possible as the earpiece speaker is only for phone calls. Your choice is the main speaker or a headset.
From this discussion:

As far as I know this is not an option.
The earpiece receiver is for phone calls, it's not a &quot;private speaker&quot;. Your choices are the iPhones main speaker or a headset.

You can request Apple to add this functionality here.