Thin films of rare-earth metal oxyhydrides, such as yttrium oxyhydrides (YH3-2xOx), show a photochromic effect where the transparency of the films decreases reversibly upon exposure to UV light. However, the exact mechanism behind this effect is unknown. In this paper, we describe the behavior of YH3-2xOx thin films, with different O2-:H- ratios, under dark and illuminated conditions using in situ muon spin relaxation (μ+SR), and compare that to an oxygen-free reference compound, yttrium dihydride (YH2-δ). The muon acts as a local magnetic probe in our compounds, giving information related to electronic, structural, and photochromic properties. Although YH2-δ is the parent compound to YH3-2xOx, the muon behavior in these two materials is different - the muon electrostatically interacts primarily with H- (dihydride) or O2- (oxyhydride) - leading to the use of different theoretical models. For YH2-δ, we observed the formation of an entangled H-μ complex and the onset of Mu+ diffusion and H- rearrangement above 150 K (EA,Γ=67±13meV). For the oxyhydrides, we adopted a transition state model, where Mu0 formation and gradual Mu+ recovery take place, accompanied by the formation of a Mu+-O2- complex and a polaron at the Y cation. The activation energy (EA,dia) associated with Mu+ recovery is dependent on lattice relaxation and is lower for thin films of higher H content (EA,dia=29-45meV). In situ illumination further reduces this energy barrier for all measured oxyhydrides, suggesting that the photochromic effect involves a reversible structural rearrangement during photodarkening.