{"action":"created","comment":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/comments/35763381","id":35763381,"diff_hunk":"@@ -28,14 +33,184 @@ namespace TitaniumWindows\n \t\t\tJSExport<AudioPlayer>::SetParent(JSExport<Titanium::Media::AudioPlayer>::Class());\r\n \t\t}\r\n \r\n+\t\tvoid AudioPlayer::postCallAsConstructor(const JSContext& js_context, const std::vector<JSValue>& arguments) \r\n+\t\t{\r\n+\t\t\tTitanium::Media::AudioPlayer::postCallAsConstructor(js_context, arguments);\r\n+\r\n+\t\t\tplayer__ = ref new Windows::UI::Xaml::Controls::MediaElement();\r\n+\t\t\tplayer__->AudioCategory = AudioCategory::BackgroundCapableMedia;\r\n+\t\t\tplayer__->AreTransportControlsEnabled = true;\r\n+\t\t\tplayer__->Visibility = Windows::UI::Xaml::Visibility::Collapsed; // Hide UI\r\n+\t\t\tplayer__->AutoPlay = false;\r\n+\t\t\tplayer__->IsLooping = false;\r\n+\t\t\tplayer__->CurrentStateChanged += ref new RoutedEventHandler([this](Platform::Object^ sender, RoutedEventArgs^ e) {\r\n+\t\t\t\tplaying__ = isPlaying();\r\n+\t\t\t\tpaused__ = isPaused();\r\n+\t\t\t\tvolume__ = player__->Volume;\r\n+\t\t\t\twaiting__ = (player__->CurrentState == MediaElementState::Buffering);\r\n+\t\t\t\tconst auto ctx = get_context();\r\n+\t\t\t\tauto event_arg = ctx.CreateObject();\r\n+\r\n+\t\t\t\tswitch (player__->CurrentState) {\r","path":"Source/Media/src/Media/AudioPlayer.cpp","position":34,"original_position":34,"commit_id":"2487854598e53f85da951cceebc9d8619223fbe9","original_commit_id":"2487854598e53f85da951cceebc9d8619223fbe9","user":{"login":"sgtcoolguy","id":3252,"avatar_url":"https://avatars.githubusercontent.com/u/3252?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtcoolguy","html_url":"https://github.com/sgtcoolguy","followers_url":"https://api.github.com/users/sgtcoolguy/followers","following_url":"https://api.github.com/users/sgtcoolguy/following{/other_user}","gists_url":"https://api.github.com/users/sgtcoolguy/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtcoolguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtcoolguy/subscriptions","organizations_url":"https://api.github.com/users/sgtcoolguy/orgs","repos_url":"https://api.github.com/users/sgtcoolguy/repos","events_url":"https://api.github.com/users/sgtcoolguy/events{/privacy}","received_events_url":"https://api.github.com/users/sgtcoolguy/received_events","type":"User","site_admin":false},"body":"This logic looks pretty much like the get_state() logic. Can it just call that?","created_at":"2015-07-29T14:18:33Z","updated_at":"2015-07-29T14:18:33Z","html_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/394#discussion_r35763381","pull_request_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394","_links":{"self":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/comments/35763381"},"html":{"href":"https://github.com/appcelerator/titanium_mobile_windows/pull/394#discussion_r35763381"},"pull_request":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394"}}},"pull_request":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394","id":40994570,"html_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/394","diff_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/394.diff","patch_url":"https://github.com/appcelerator/titanium_mobile_windows/pull/394.patch","issue_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/394","number":394,"state":"open","locked":false,"title":"Implement Ti.Media.VideoPlayer, Sound and AudioPlayer","user":{"login":"infosia","id":1661068,"avatar_url":"https://avatars.githubusercontent.com/u/1661068?v=3","gravatar_id":"","url":"https://api.github.com/users/infosia","html_url":"https://github.com/infosia","followers_url":"https://api.github.com/users/infosia/followers","following_url":"https://api.github.com/users/infosia/following{/other_user}","gists_url":"https://api.github.com/users/infosia/gists{/gist_id}","starred_url":"https://api.github.com/users/infosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infosia/subscriptions","organizations_url":"https://api.github.com/users/infosia/orgs","repos_url":"https://api.github.com/users/infosia/repos","events_url":"https://api.github.com/users/infosia/events{/privacy}","received_events_url":"https://api.github.com/users/infosia/received_events","type":"User","site_admin":false},"body":"[TIMOB-17913](https://jira.appcelerator.org/browse/TIMOB-17913) and [TIMOB-17918](https://jira.appcelerator.org/browse/TIMOB-17918)\r\n\r\n- Ti.Media.Sound\r\n- Ti.Media.VideoPlayer\r\n- Ti.Media.AudioPlayer\r\n- Add sample media resource (cricket.wav)\r\n\r\nVideoPlayer:\r\n```javascript\r\nvar window = Ti.UI.createWindow({});\r\nvar player = Ti.Media.createVideoPlayer({ url: \"cricket.wav\" });\r\n\r\nplayer.addEventListener('change', function (e) {\r\n    Ti.API.info('[video change]');\r\n});\r\n\r\nplayer.addEventListener('complete', function (e) {\r\n    Ti.API.info('[video complete]');\r\n});\r\n\r\nplayer.addEventListener('error', function (e) {\r\n    Ti.API.info('[video error]' + e.message);\r\n});\r\n\r\nwindow.add(player);\r\nwindow.open();\r\n```\r\n\r\nSound\r\n```javascript\r\nvar window = Ti.UI.createWindow({});\r\nvar player = Ti.Media.createSound({ url: \"cricket.wav\" });\r\nvar playButton = Ti.UI.createButton({title:'Play'});\r\n\r\nplayButton.addEventListener('click', function () {\r\n    player.play();\r\n});\r\n\r\nplayer.addEventListener('change', function (e) {\r\n    Ti.API.info('[sound change]');\r\n});\r\n\r\nplayer.addEventListener('complete', function (e) {\r\n    Ti.API.info('[sound complete]');\r\n});\r\n\r\nplayer.addEventListener('error', function (e) {\r\n    Ti.API.info('[sound error]' + e.message);\r\n});\r\n\r\nwindow.add(playButton);\r\nwindow.open();\r\n```\r\n\r\nNote: Using `Windows::UI::Xaml::Controls::MediaElement` behind `Ti.Media.Sound` and `Ti.Media.AudioPlayer` was bit tricky because `MediaElement` is Xaml UI component but `Sound` and `AudioPlayer` are not a Titanium View proxy. I ended up adding \"hidden\" MediaElement onto current Window because `MediaElement` doesn't work when it is not part of UI.\r\n","created_at":"2015-07-28T10:04:57Z","updated_at":"2015-07-29T14:18:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb1f42559635827209d0967e8779ec058fb7bcfd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394/commits","review_comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394/comments","review_comment_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/394/comments","statuses_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/statuses/2487854598e53f85da951cceebc9d8619223fbe9","head":{"label":"infosia:TIMOB-17918-PR","ref":"TIMOB-17918-PR","sha":"2487854598e53f85da951cceebc9d8619223fbe9","user":{"login":"infosia","id":1661068,"avatar_url":"https://avatars.githubusercontent.com/u/1661068?v=3","gravatar_id":"","url":"https://api.github.com/users/infosia","html_url":"https://github.com/infosia","followers_url":"https://api.github.com/users/infosia/followers","following_url":"https://api.github.com/users/infosia/following{/other_user}","gists_url":"https://api.github.com/users/infosia/gists{/gist_id}","starred_url":"https://api.github.com/users/infosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infosia/subscriptions","organizations_url":"https://api.github.com/users/infosia/orgs","repos_url":"https://api.github.com/users/infosia/repos","events_url":"https://api.github.com/users/infosia/events{/privacy}","received_events_url":"https://api.github.com/users/infosia/received_events","type":"User","site_admin":false},"repo":{"id":33272635,"name":"titanium_mobile_windows","full_name":"infosia/titanium_mobile_windows","owner":{"login":"infosia","id":1661068,"avatar_url":"https://avatars.githubusercontent.com/u/1661068?v=3","gravatar_id":"","url":"https://api.github.com/users/infosia","html_url":"https://github.com/infosia","followers_url":"https://api.github.com/users/infosia/followers","following_url":"https://api.github.com/users/infosia/following{/other_user}","gists_url":"https://api.github.com/users/infosia/gists{/gist_id}","starred_url":"https://api.github.com/users/infosia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infosia/subscriptions","organizations_url":"https://api.github.com/users/infosia/orgs","repos_url":"https://api.github.com/users/infosia/repos","events_url":"https://api.github.com/users/infosia/events{/privacy}","received_events_url":"https://api.github.com/users/infosia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/infosia/titanium_mobile_windows","description":"Windows platform for Titanium Mobile","fork":true,"url":"https://api.github.com/repos/infosia/titanium_mobile_windows","forks_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/forks","keys_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/teams","hooks_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/hooks","issue_events_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/issues/events{/number}","events_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/events","assignees_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/assignees{/user}","branches_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/branches{/branch}","tags_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/tags","blobs_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/statuses/{sha}","languages_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/languages","stargazers_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/stargazers","contributors_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/contributors","subscribers_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/subscribers","subscription_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/subscription","commits_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/contents/{+path}","compare_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/merges","archive_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/downloads","issues_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/issues{/number}","pulls_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/pulls{/number}","milestones_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/milestones{/number}","notifications_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/labels{/name}","releases_url":"https://api.github.com/repos/infosia/titanium_mobile_windows/releases{/id}","created_at":"2015-04-01T20:57:51Z","updated_at":"2015-05-08T01:24:55Z","pushed_at":"2015-07-29T07:17:22Z","git_url":"git://github.com/infosia/titanium_mobile_windows.git","ssh_url":"git@github.com:infosia/titanium_mobile_windows.git","clone_url":"https://github.com/infosia/titanium_mobile_windows.git","svn_url":"https://github.com/infosia/titanium_mobile_windows","homepage":null,"size":38987,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"appcelerator:master","ref":"master","sha":"7dd9c5b393c5fe52d1cfc35baa50b23dcc54643b","user":{"login":"appcelerator","id":82188,"avatar_url":"https://avatars.githubusercontent.com/u/82188?v=3","gravatar_id":"","url":"https://api.github.com/users/appcelerator","html_url":"https://github.com/appcelerator","followers_url":"https://api.github.com/users/appcelerator/followers","following_url":"https://api.github.com/users/appcelerator/following{/other_user}","gists_url":"https://api.github.com/users/appcelerator/gists{/gist_id}","starred_url":"https://api.github.com/users/appcelerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appcelerator/subscriptions","organizations_url":"https://api.github.com/users/appcelerator/orgs","repos_url":"https://api.github.com/users/appcelerator/repos","events_url":"https://api.github.com/users/appcelerator/events{/privacy}","received_events_url":"https://api.github.com/users/appcelerator/received_events","type":"Organization","site_admin":false},"repo":{"id":27684398,"name":"titanium_mobile_windows","full_name":"appcelerator/titanium_mobile_windows","owner":{"login":"appcelerator","id":82188,"avatar_url":"https://avatars.githubusercontent.com/u/82188?v=3","gravatar_id":"","url":"https://api.github.com/users/appcelerator","html_url":"https://github.com/appcelerator","followers_url":"https://api.github.com/users/appcelerator/followers","following_url":"https://api.github.com/users/appcelerator/following{/other_user}","gists_url":"https://api.github.com/users/appcelerator/gists{/gist_id}","starred_url":"https://api.github.com/users/appcelerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appcelerator/subscriptions","organizations_url":"https://api.github.com/users/appcelerator/orgs","repos_url":"https://api.github.com/users/appcelerator/repos","events_url":"https://api.github.com/users/appcelerator/events{/privacy}","received_events_url":"https://api.github.com/users/appcelerator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appcelerator/titanium_mobile_windows","description":"Windows platform for Titanium Mobile","fork":false,"url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows","forks_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/forks","keys_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/teams","hooks_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/hooks","issue_events_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/events{/number}","events_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/events","assignees_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/assignees{/user}","branches_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/branches{/branch}","tags_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/tags","blobs_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/statuses/{sha}","languages_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/languages","stargazers_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/stargazers","contributors_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/contributors","subscribers_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/subscribers","subscription_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/subscription","commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/contents/{+path}","compare_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/merges","archive_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/downloads","issues_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues{/number}","pulls_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls{/number}","milestones_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/milestones{/number}","notifications_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/labels{/name}","releases_url":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/releases{/id}","created_at":"2014-12-07T20:55:18Z","updated_at":"2015-07-16T07:43:44Z","pushed_at":"2015-07-29T02:53:06Z","git_url":"git://github.com/appcelerator/titanium_mobile_windows.git","ssh_url":"git@github.com:appcelerator/titanium_mobile_windows.git","clone_url":"https://github.com/appcelerator/titanium_mobile_windows.git","svn_url":"https://github.com/appcelerator/titanium_mobile_windows","homepage":null,"size":41764,"stargazers_count":8,"watchers_count":8,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":2,"forks":9,"open_issues":2,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394"},"html":{"href":"https://github.com/appcelerator/titanium_mobile_windows/pull/394"},"issue":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/394"},"comments":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/issues/394/comments"},"review_comments":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394/comments"},"review_comment":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/pulls/394/commits"},"statuses":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile_windows/statuses/2487854598e53f85da951cceebc9d8619223fbe9"}}}}