If your videos are restricted to your site thus we can not make any access for video from the app or site, because it is restricted from somewhere else. Not from your domain.
But the given code will disable the direct access unit page so that the user can go to the unit page view the content after login.