{"action":"created","issue":{"url":"https://api.github.com/repos/CookPete/react-player/issues/18","labels_url":"https://api.github.com/repos/CookPete/react-player/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/CookPete/react-player/issues/18/comments","events_url":"https://api.github.com/repos/CookPete/react-player/issues/18/events","html_url":"https://github.com/CookPete/react-player/issues/18","id":124109231,"number":18,"title":"react-player attempts to call `this.player.getDuration()` before method is available","user":{"login":"Fauntleroy","id":507047,"avatar_url":"https://avatars.githubusercontent.com/u/507047?v=3","gravatar_id":"","url":"https://api.github.com/users/Fauntleroy","html_url":"https://github.com/Fauntleroy","followers_url":"https://api.github.com/users/Fauntleroy/followers","following_url":"https://api.github.com/users/Fauntleroy/following{/other_user}","gists_url":"https://api.github.com/users/Fauntleroy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fauntleroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fauntleroy/subscriptions","organizations_url":"https://api.github.com/users/Fauntleroy/orgs","repos_url":"https://api.github.com/users/Fauntleroy/repos","events_url":"https://api.github.com/users/Fauntleroy/events{/privacy}","received_events_url":"https://api.github.com/users/Fauntleroy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-28T19:14:38Z","updated_at":"2015-12-28T19:26:30Z","closed_at":null,"body":"If you tell the YouTube player to seek before the SDK has finished loading, `react-player` will attempt to call `getDuration()` and throw. I haven't checked into this with the other players yet.\r\n\r\nShould be a simple fix: add a flag for whether or not the SDK has loaded yet. If the flag is false, don't try to call any methods provided by that SDK. Might also want to wrap the SDK methods with something normalized that does that check before calling the real method.\r\n\r\n(Sorry about making issues with recommendations but not pull reqs—it's a bit difficult to get the full flow going while on holiday)"},"comment":{"url":"https://api.github.com/repos/CookPete/react-player/issues/comments/167633451","html_url":"https://github.com/CookPete/react-player/issues/18#issuecomment-167633451","issue_url":"https://api.github.com/repos/CookPete/react-player/issues/18","id":167633451,"user":{"login":"CookPete","id":1926029,"avatar_url":"https://avatars.githubusercontent.com/u/1926029?v=3","gravatar_id":"","url":"https://api.github.com/users/CookPete","html_url":"https://github.com/CookPete","followers_url":"https://api.github.com/users/CookPete/followers","following_url":"https://api.github.com/users/CookPete/following{/other_user}","gists_url":"https://api.github.com/users/CookPete/gists{/gist_id}","starred_url":"https://api.github.com/users/CookPete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CookPete/subscriptions","organizations_url":"https://api.github.com/users/CookPete/orgs","repos_url":"https://api.github.com/users/CookPete/repos","events_url":"https://api.github.com/users/CookPete/events{/privacy}","received_events_url":"https://api.github.com/users/CookPete/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T19:26:30Z","updated_at":"2015-12-28T19:26:30Z","body":"I'm surprised the function doesn't [return here](https://github.com/CookPete/react-player/blob/master/src/players/YouTube.js#L95) in that case. Maybe that check needs to be better than just whether `this.player` exists.\r\n\r\n> Sorry about making issues with recommendations but not pull reqs—it's a bit difficult to get the full flow going while on holiday\r\n\r\nNo problem. Stop developing on holiday! :beers: "}}