  The perovskite BaSnO$_3$ provides a promising platform for the realization of
an earth abundant $n$-type transparent conductor. Its optical properties are
dominated by a dispersive conduction band of Sn $5s$ states, and by a flatter
valence band of O $2p$ states, with an overall indirect gap of about $2.9$ eV.
Using first-principles methods, we study the optical properties of BaSnO$_3$
and show that both electron-phonon interactions and exact exchange, included
using a hybrid functional, are necessary to obtain a qualitatively correct
description of optical absorption in this material. In particular, the
electron-phonon interaction drives phonon-assisted optical absorption across
the minimum indirect gap and therefore determines the absorption onset, and it
also leads to the temperature dependence of the absorption spectrum. Electronic
correlations beyond semilocal density functional theory are key to detemine the
dynamical stability of the cubic perovskite structure, as well as the correct
energies of the conduction bands that dominate absorption. Our work
demonstrates that phonon-mediated absorption processes should be included in
the design of novel transparent conductor materials.
