title: How to hide YouTube video after it ends using googleapis package?
body: <p>I want to operate with googleapis package. I want simply to hide a YouTube video after it ends. I have the following code:</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'dart:html';
  import 'package:googleapis/youtube/v3.dart';
  import 'package:googleapis_auth/auth_io.dart';
  
  final _credentials = new ServiceAccountCredentials.fromJson(r'''
  {
    "private_key_id": ...,
    "private_key": ...,
    "client_email": ...,
    "client_id": ...,
    "type": "service_account"
  }
  ''');
  
  const _SCOPES = const [StorageApi.DevstorageReadOnlyScope];
  
  main(){
  // insert stylesheet for video (width, height, border, etc.) - works well
  LinkElement styles=new LinkElement();
  styles..href='iframe.css'
       ..rel='stylesheet'
       ..type='text/css';
  document.head.append(styles);
  
  //add iframe element - works also well
  IFrameElement video=new IFrameElement();
  video.attributes={'allowfullscreen':'','seamless':'','src':'http://www.youtube.com/embed/ORsFFjt1x6Q?autoplay=1&amp;enablejsapi=1'};
  document.body.insertAdjacentElement('afterBegin',video);
  
  //check if the video has ended - probably doesn't work
  if(video.contentDocument.onLoad){
  if(video.getPlayerState==0){
  video.remove();
  }
  }
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>