at the touch of a button I see a youtube video.
is possible to lock the screen in landscape position and when I get out of youtube re-lock the screen in portrait position?
I tried with SetScreenOrientation but does not work.
Have your main Activity set for Portrait only mode. Now create a new(second) Activity in your app that shows in landscape mode only, for showing the YouTube video. Each Activity will then be locked and in the proper orientation.
How do you call the video, is it another application ?
I tested on both my devices, not with a video, when setting a given orientation rotating the device doesn't change the orientation.