1<!--
2Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3This code may only be used under the BSD style license found at https://polymer.github.io/LICENSE.txt
4The complete set of authors may be found at https://polymer.github.io/AUTHORS.txt
5The complete set of contributors may be found at https://polymer.github.io/CONTRIBUTORS.txt
6Code distributed by Google as part of the polymer project is also
7subject to an additional IP rights grant found at https://polymer.github.io/PATENTS.txt
8-->
9
10<link rel="import" href="../polymer/polymer.html">
11<link rel="import" href="../iron-jsonp-library/iron-jsonp-library.html">
12
13<!--
14Dynamically loads the Google Youtube Iframe API, firing the `api-load` event when ready.
15
16Any number of components can use `<google-youtube-api>` elements, and the library will only be loaded once.
17
18https://developers.google.com/youtube/iframe_api_reference
19-->
20<script>
21  Polymer({
22
23    is: 'google-youtube-api',
24
25    behaviors: [
26      Polymer.IronJsonpLibraryBehavior
27    ],
28
29    properties: {
30
31      /** @private */
32      libraryUrl:  {
33        type: String,
34        value: 'https://www.youtube.com/iframe_api'
35      },
36
37      /**
38       * Fired when the API library is loaded and available.
39       * @event api-load
40       */
41      /**
42       * Name of event fired when library loads.
43       */
44      notifyEvent:  {
45        type: String,
46        value: 'api-load'
47      },
48
49      callbackName:  {
50        type: String,
51        value: 'onYouTubeIframeAPIReady'
52      }
53
54    },
55
56    get api() {
57      return YT;
58    }
59
60  });
61</script>
62