2. Given the function $f(x)=\pi \sin \frac{x}{4}$. If there exist real numbers $x_{1}, x_{2}$, such that for any real number $x$, we have
$$
f\left(x_{1}\right) \leqslant f(x) \leqslant f\left(x_{2}\right),
$$
then the minimum value of $\left|x_{1}-x_{2}\right|$ is ( ).
(A) $8 \pi$
(B) $4 \pi$
(C) $2 \pi$
(D) $\pi$
2.B.

Obviously, $f\left(x_{1}\right)$ and $f\left(x_{2}\right)$ are the minimum and maximum values of $f(x)$, respectively, i.e., $\sin \frac{x_{1}}{4}=-1, \sin \frac{x_{2}}{4}=1$. Therefore, $x_{1}=8 k_{1} \pi-2 \pi, x_{2}=8 k_{2} \pi+2 \pi$.
Thus, $\left|x_{1}-x_{2}\right| \geqslant 4 \pi$.