Skip to content

Commit

Permalink
Prevent YouTube SDK from being loaded twice
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed Jan 2, 2016
1 parent d80c1a2 commit f862add
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/players/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ export default class YouTube extends Base {
if (previousOnReady) previousOnReady()
resolve(window[SDK_GLOBAL])
}
loadScript(SDK_URL, err => {
if (err) reject(err)
})
if (!this.loadingSDK) {
loadScript(SDK_URL, err => {
if (err) reject(err)
})
this.loadingSDK = true
}
})
}
load (url, playing) {
Expand Down

0 comments on commit f862add

Please sign in to comment.