title: Clear Mask on UIView (actually a video view)
body: <p>I'm using OpenTok which is a webRTC framework. What I need to do is take the displayed video view and crop it to a circle. Problem is, since this video avatar view will be placed in a view with a clear background, I can't just use a mask as shown in this S.O. question:</p>
  
  <p><a href="https://stackoverflow.com/questions/15375777/cut-out-shape-with-animation">Cut Out Shape with Animation</a></p>
  
  <p>I've also tried to use <code>layer.radius</code> in a UIView category:</p>
  
  <pre><code>-(void)setRoundedViewToDiameter:(float)newSize;
  {
      CGPoint saveCenter = self.center;
      CGRect newFrame = CGRectMake(self.frame.origin.x, self.frame.origin.y, newSize, newSize);
      self.frame = newFrame;
      self.layer.cornerRadius = newSize / 2.0;
      self.center = saveCenter;
  }
  </code></pre>
  
  <p>And then applied like so:</p>
  
  <pre><code>- (void) setUserVideoView:(UIView *)view {
  
      [view setRoundedViewToDiameter:[WSUserView dimForUserAvatar:_sizeIndex]];
      self.userVideo = view;
      [self.userVideo setRoundedViewToDiameter:[WSUserView dimForUserAvatar:_sizeIndex]];
      [self addSubview:self.userVideo];
      [self sendSubviewToBack:self.userVideo];
  
      [self layoutSubviews];
  
  }
  </code></pre>
  
  <p>But it's still an uncropped rectangle. Here's the portion of the video view. I'm showing user image avatars at first, but then when a video stream connects I want to replace the image with the video view, but as a circle. The left image is the stream view that I need make a circle.</p>
  
  <p><img src="https://i.stack.imgur.com/DuuCz.png" alt="enter image description here"></p>
  
  <p>Also, here's the inspector view of the video view I'm trying to crop. As you can see, it's a <code>OTGLKVideoView</code> class. </p>
  
  <p><img src="https://i.stack.imgur.com/BjSCi.png" alt="enter image description here"></p>