Protect video content out of content area with payperpview

Hey,

how can I embed this code to protect videos that are streamed outside of the content area in my template?

Thanks for giving a more detailed instruction how and where to embed the provided codes in "template functions"!