The literal meaning of ～うち is “the duration in which …” and this post explains the meaning and usage when it’s used with the particles は and が.
～うちに means “while ～” or “before the state of ～ ends.” It is similar to ～あいだに but ～うちに has a bit more urgent sound. Read examples here.
～あいだに and ～うちに can both be translated as “while ～” but they are not always interchangeable. This post explains when to use which.