$$
\begin{array}{l}
\text { 4. Let } \theta \in\left[0, \frac{\pi}{2}\right] \text {, and } \\
\cos ^{2} \theta+2 m \sin \theta-2 m-1<0
\end{array}
$$

Always holds. Then the range of $m$ is $\qquad$
4. $m>0$.

Taking $m$ as the main variable. From the condition, $2 m(\sin \theta-1)<\frac{\sin ^{2} \theta}{\sin \theta-1}$ always holds, it is only necessary that $2 m>t$, where $t$ is the maximum value of $\frac{\sin ^{2} \theta}{\sin \theta-1}$.
And $\frac{\sin ^{2} \theta}{\sin \theta-1}=\sin \theta-1+\frac{1}{\sin \theta-1}+2$.
Given $\theta \in\left[0, \frac{\pi}{2}\right)$, we have $\sin \theta-1+\frac{1}{\sin \theta-1}+2 \leqslant 0$.
The equality holds if and only if $\sin \theta-1=-1, \theta=0$.
Therefore, $m>0$.