{"action":"created","comment":{"url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/comments/65006513","id":65006513,"diff_hunk":"@@ -149,6 +150,17 @@ var WaveSurfer = {\n     },\n \n     play: function (start, end) {\n+        if (!this.backend.buffer) {\n+            this.load(this.tempUrl, null);\n+            this.once('ready', (function() {\n+                this._play(start, end);\n+            }).bind(this));","path":"dist/wavesurfer.js","position":16,"original_position":16,"commit_id":"0cefe347a4bce9dacd99853292adbe0838397f4d","original_commit_id":"0cefe347a4bce9dacd99853292adbe0838397f4d","user":{"login":"katspaugh","id":381895,"avatar_url":"https://avatars.githubusercontent.com/u/381895?v=3","gravatar_id":"","url":"https://api.github.com/users/katspaugh","html_url":"https://github.com/katspaugh","followers_url":"https://api.github.com/users/katspaugh/followers","following_url":"https://api.github.com/users/katspaugh/following{/other_user}","gists_url":"https://api.github.com/users/katspaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/katspaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katspaugh/subscriptions","organizations_url":"https://api.github.com/users/katspaugh/orgs","repos_url":"https://api.github.com/users/katspaugh/repos","events_url":"https://api.github.com/users/katspaugh/events{/privacy}","received_events_url":"https://api.github.com/users/katspaugh/received_events","type":"User","site_admin":false},"body":"```\r\nthis.once('ready', this._play(this, start, end));\r\n```","created_at":"2016-05-29T15:11:52Z","updated_at":"2016-05-29T15:11:52Z","html_url":"https://github.com/katspaugh/wavesurfer.js/pull/733#discussion_r65006513","pull_request_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733","_links":{"self":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/comments/65006513"},"html":{"href":"https://github.com/katspaugh/wavesurfer.js/pull/733#discussion_r65006513"},"pull_request":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733"}}},"pull_request":{"url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733","id":71812511,"html_url":"https://github.com/katspaugh/wavesurfer.js/pull/733","diff_url":"https://github.com/katspaugh/wavesurfer.js/pull/733.diff","patch_url":"https://github.com/katspaugh/wavesurfer.js/pull/733.patch","issue_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/733","number":733,"state":"open","locked":false,"title":"Load peaks only","user":{"login":"cdelguercio","id":1480795,"avatar_url":"https://avatars.githubusercontent.com/u/1480795?v=3","gravatar_id":"","url":"https://api.github.com/users/cdelguercio","html_url":"https://github.com/cdelguercio","followers_url":"https://api.github.com/users/cdelguercio/followers","following_url":"https://api.github.com/users/cdelguercio/following{/other_user}","gists_url":"https://api.github.com/users/cdelguercio/gists{/gist_id}","starred_url":"https://api.github.com/users/cdelguercio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdelguercio/subscriptions","organizations_url":"https://api.github.com/users/cdelguercio/orgs","repos_url":"https://api.github.com/users/cdelguercio/repos","events_url":"https://api.github.com/users/cdelguercio/events{/privacy}","received_events_url":"https://api.github.com/users/cdelguercio/received_events","type":"User","site_admin":false},"body":"So I created a new function called loadPeaksOnly, which is poorly named, but what it does is save the url string temporarily (but doesn't download the audio) and then draw the peaks that the user supplied. The audio is only downloaded in the event of a seekTo or play action. This is very rough hacky code, and I'd appreciate some input on how to design it better. My javascript skills are only so-so.\r\n\r\nwavesurfer.loadPeaksOnly('/api/v1/song/1/', [0.5, 0.6, 0.7, 1.0, 0.1, 0.3])\r\n//then the waveform is visible\r\n// once the user clicks on the waveform or initiates a play action, the audio will be downloaded from the given url ('/api/v1/song/1/' in this case)","created_at":"2016-05-28T21:52:47Z","updated_at":"2016-05-29T15:11:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733/commits","review_comments_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733/comments","review_comment_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/733/comments","statuses_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/statuses/0cefe347a4bce9dacd99853292adbe0838397f4d","head":{"label":"cdelguercio:load-peaks-only","ref":"load-peaks-only","sha":"0cefe347a4bce9dacd99853292adbe0838397f4d","user":{"login":"cdelguercio","id":1480795,"avatar_url":"https://avatars.githubusercontent.com/u/1480795?v=3","gravatar_id":"","url":"https://api.github.com/users/cdelguercio","html_url":"https://github.com/cdelguercio","followers_url":"https://api.github.com/users/cdelguercio/followers","following_url":"https://api.github.com/users/cdelguercio/following{/other_user}","gists_url":"https://api.github.com/users/cdelguercio/gists{/gist_id}","starred_url":"https://api.github.com/users/cdelguercio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdelguercio/subscriptions","organizations_url":"https://api.github.com/users/cdelguercio/orgs","repos_url":"https://api.github.com/users/cdelguercio/repos","events_url":"https://api.github.com/users/cdelguercio/events{/privacy}","received_events_url":"https://api.github.com/users/cdelguercio/received_events","type":"User","site_admin":false},"repo":{"id":58097919,"name":"wavesurfer.js","full_name":"cdelguercio/wavesurfer.js","owner":{"login":"cdelguercio","id":1480795,"avatar_url":"https://avatars.githubusercontent.com/u/1480795?v=3","gravatar_id":"","url":"https://api.github.com/users/cdelguercio","html_url":"https://github.com/cdelguercio","followers_url":"https://api.github.com/users/cdelguercio/followers","following_url":"https://api.github.com/users/cdelguercio/following{/other_user}","gists_url":"https://api.github.com/users/cdelguercio/gists{/gist_id}","starred_url":"https://api.github.com/users/cdelguercio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdelguercio/subscriptions","organizations_url":"https://api.github.com/users/cdelguercio/orgs","repos_url":"https://api.github.com/users/cdelguercio/repos","events_url":"https://api.github.com/users/cdelguercio/events{/privacy}","received_events_url":"https://api.github.com/users/cdelguercio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cdelguercio/wavesurfer.js","description":"Navigable waveform built on Web Audio and Canvas","fork":true,"url":"https://api.github.com/repos/cdelguercio/wavesurfer.js","forks_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/forks","keys_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/teams","hooks_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/hooks","issue_events_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/issues/events{/number}","events_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/events","assignees_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/assignees{/user}","branches_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/branches{/branch}","tags_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/tags","blobs_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/statuses/{sha}","languages_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/languages","stargazers_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/stargazers","contributors_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/contributors","subscribers_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/subscribers","subscription_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/subscription","commits_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/contents/{+path}","compare_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/merges","archive_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/downloads","issues_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/issues{/number}","pulls_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/pulls{/number}","milestones_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/milestones{/number}","notifications_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/labels{/name}","releases_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/releases{/id}","deployments_url":"https://api.github.com/repos/cdelguercio/wavesurfer.js/deployments","created_at":"2016-05-05T02:21:27Z","updated_at":"2016-05-05T02:21:28Z","pushed_at":"2016-05-28T21:47:17Z","git_url":"git://github.com/cdelguercio/wavesurfer.js.git","ssh_url":"git@github.com:cdelguercio/wavesurfer.js.git","clone_url":"https://github.com/cdelguercio/wavesurfer.js.git","svn_url":"https://github.com/cdelguercio/wavesurfer.js","homepage":"http://wavesurfer-js.org","size":29485,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"katspaugh:master","ref":"master","sha":"92234a2369dbf4364a59c7dff95ae8e6e4418a40","user":{"login":"katspaugh","id":381895,"avatar_url":"https://avatars.githubusercontent.com/u/381895?v=3","gravatar_id":"","url":"https://api.github.com/users/katspaugh","html_url":"https://github.com/katspaugh","followers_url":"https://api.github.com/users/katspaugh/followers","following_url":"https://api.github.com/users/katspaugh/following{/other_user}","gists_url":"https://api.github.com/users/katspaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/katspaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katspaugh/subscriptions","organizations_url":"https://api.github.com/users/katspaugh/orgs","repos_url":"https://api.github.com/users/katspaugh/repos","events_url":"https://api.github.com/users/katspaugh/events{/privacy}","received_events_url":"https://api.github.com/users/katspaugh/received_events","type":"User","site_admin":false},"repo":{"id":3618686,"name":"wavesurfer.js","full_name":"katspaugh/wavesurfer.js","owner":{"login":"katspaugh","id":381895,"avatar_url":"https://avatars.githubusercontent.com/u/381895?v=3","gravatar_id":"","url":"https://api.github.com/users/katspaugh","html_url":"https://github.com/katspaugh","followers_url":"https://api.github.com/users/katspaugh/followers","following_url":"https://api.github.com/users/katspaugh/following{/other_user}","gists_url":"https://api.github.com/users/katspaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/katspaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katspaugh/subscriptions","organizations_url":"https://api.github.com/users/katspaugh/orgs","repos_url":"https://api.github.com/users/katspaugh/repos","events_url":"https://api.github.com/users/katspaugh/events{/privacy}","received_events_url":"https://api.github.com/users/katspaugh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/katspaugh/wavesurfer.js","description":"Navigable waveform built on Web Audio and Canvas","fork":false,"url":"https://api.github.com/repos/katspaugh/wavesurfer.js","forks_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/forks","keys_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/teams","hooks_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/hooks","issue_events_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/events{/number}","events_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/events","assignees_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/assignees{/user}","branches_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/branches{/branch}","tags_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/tags","blobs_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/statuses/{sha}","languages_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/languages","stargazers_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/stargazers","contributors_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/contributors","subscribers_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/subscribers","subscription_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/subscription","commits_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/contents/{+path}","compare_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/merges","archive_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/downloads","issues_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues{/number}","pulls_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls{/number}","milestones_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/milestones{/number}","notifications_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/labels{/name}","releases_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/releases{/id}","deployments_url":"https://api.github.com/repos/katspaugh/wavesurfer.js/deployments","created_at":"2012-03-04T14:38:02Z","updated_at":"2016-05-27T03:23:32Z","pushed_at":"2016-05-28T21:52:47Z","git_url":"git://github.com/katspaugh/wavesurfer.js.git","ssh_url":"git@github.com:katspaugh/wavesurfer.js.git","clone_url":"https://github.com/katspaugh/wavesurfer.js.git","svn_url":"https://github.com/katspaugh/wavesurfer.js","homepage":"http://wavesurfer-js.org","size":30482,"stargazers_count":1733,"watchers_count":1733,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":436,"mirror_url":null,"open_issues_count":84,"forks":436,"open_issues":84,"watchers":1733,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733"},"html":{"href":"https://github.com/katspaugh/wavesurfer.js/pull/733"},"issue":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/733"},"comments":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/issues/733/comments"},"review_comments":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733/comments"},"review_comment":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/pulls/733/commits"},"statuses":{"href":"https://api.github.com/repos/katspaugh/wavesurfer.js/statuses/0cefe347a4bce9dacd99853292adbe0838397f4d"}}}}
{"actor":{"display_login":"katspaugh"}}