I have searched for this in the issues tracker.
Is there built-in support for playing the video on a secondary screen without the primary screen needing to be mirrored? I have found something similar in MediaRouter's doc. Is this possible with Exoplayer's cast extension?
The ExoPlayer Cast extension works with Google cast devices. It does play a media either locally or remotely but not both at the time.
I'm not completely sure, but I think Miracast and Google Cast are not compatible, so the answer to your question would probably be that this is not supported, I'm afraid.
So what would be the best way to cast local files using ExoPlayer?
ExoPlayer does not offer much help with this, I'm afraid. This is more a general Android app task than a media player task.
A cast device expects an uri from which the cast device can stream the media. So what needs to be done for casting local file is providing such a stream over a uri.
This would include starting a web server on the local device and make the cast device connect to that web server. I think that's how some apps do it, but I've never done this myself. It would require you to start a foreground service to have this working when the app goes to background.
I think Android's Presentation API can help with this.
Most helpful comment
I think Android's Presentation API can help with this.