Example 5 In the Cartesian coordinate system, $O$ is the origin, $A$ and $B$ are points in the first quadrant, and $A$ lies on the line $y=\tan \theta x$, where $\theta \in\left(\frac{\pi}{4}, \frac{\pi}{2}\right),|O A|=\frac{1}{\sqrt{2}-\cos \theta}, B$ is a point on the hyperbola $x^{2}-y^{2}=1$ that minimizes the area of $\triangle O A B$. Find the value of $\theta$ in $\left(\frac{\pi}{4}, \frac{\pi}{2}\right)$ that maximizes the area of $\triangle O A B$, and the maximum area.
As shown in Figure 8-4, $B$ should be the point of tangency where a line parallel to $OA$ and tangent to the hyperbola $x^{2}-y^{2}=1$. Let this tangent be $S_{\triangle I M B}=\frac{1}{2}|O A| \cdot h$, where $h$ represents the height from the base $O A$ of $\triangle O A B$.

By the distance formula between parallel lines, $h=\frac{\sqrt{\tan ^{2} \theta-1}}{\sqrt{\tan ^{2} \theta+1}}$. Therefore,
$S_{\text {IAA }}=\frac{1}{2} \cdot \frac{\sqrt{\tan ^{2} \theta-1}}{\sqrt{\tan ^{2} \theta+1}} \cdot \frac{1}{\sqrt{2}-\cos \theta}$.
Let $\cos \theta=t, y=\frac{\sqrt{\tan ^{2} \theta-1}}{\sqrt{1+\tan ^{2} \theta}} \frac{1}{\sqrt{2}-\cos \theta}$, simplifying and rearranging, we get
$\left(y^{2}+2\right) t^{2}-2 \sqrt{2} y^{2} t+2 y^{2}-1=0$.
By $\Delta^{\prime}=8 y^{4}-4\left(y^{2}+2\right)\left(2 y^{2}-1\right) \geqslant 0, y^{2} \geqslant \frac{2}{3}, y \geqslant \frac{\sqrt{6}}{3}$, and when $\cos \theta=\frac{\sqrt{2}}{4}, \theta=\arccos \frac{\sqrt{2}}{4} \in$ $\left(\frac{\pi}{4}, \frac{\pi}{2}\right)$, $S_{\triangle C A B}$ has a minimum value of $\frac{\sqrt{6}}{6}$.
The equation of the line is $y=\tan \theta x+m$, substituting into $x^{2}-y^{2}=1$,
By $\Delta=0$, we have $m=\sqrt{\tan ^{2} \theta-1}$.