{"action":"created","issue":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7479","labels_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7479/labels{/name}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7479/comments","events_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7479/events","html_url":"https://github.com/appcelerator/titanium_mobile/pull/7479","id":118207204,"number":7479,"title":"[TIMOB-19666] iOS 9.1: Support PHLivePhoto + PHLivePhotoView","user":{"login":"hansemannn","id":10667698,"avatar_url":"https://avatars.githubusercontent.com/u/10667698?v=3","gravatar_id":"","url":"https://api.github.com/users/hansemannn","html_url":"https://github.com/hansemannn","followers_url":"https://api.github.com/users/hansemannn/followers","following_url":"https://api.github.com/users/hansemannn/following{/other_user}","gists_url":"https://api.github.com/users/hansemannn/gists{/gist_id}","starred_url":"https://api.github.com/users/hansemannn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansemannn/subscriptions","organizations_url":"https://api.github.com/users/hansemannn/orgs","repos_url":"https://api.github.com/users/hansemannn/repos","events_url":"https://api.github.com/users/hansemannn/events{/privacy}","received_events_url":"https://api.github.com/users/hansemannn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-11-21T16:37:26Z","updated_at":"2015-11-30T19:36:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7479","html_url":"https://github.com/appcelerator/titanium_mobile/pull/7479","diff_url":"https://github.com/appcelerator/titanium_mobile/pull/7479.diff","patch_url":"https://github.com/appcelerator/titanium_mobile/pull/7479.patch"},"body":"JIRA: https://jira.appcelerator.org/browse/TIMOB-19666\r\n\r\nDemo:\r\n```javascropt\r\nvar window = Ti.UI.createWindow({\r\n  title: \"iOS 9.1 Live Photos\",\r\n  backgroundColor: \"#fff\"\r\n});\r\n\r\nvar view = null;\r\n\r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n  window: window\r\n});\r\n\r\nvar btn1 = Ti.UI.createButton({\r\n  systemButton: Ti.UI.iPhone.SystemButton.ADD,\r\n  top:30\r\n});\r\n\r\nbtn1.addEventListener(\"click\", openGallery);\r\n\r\nvar btn2 = Ti.UI.createButton({\r\n  systemButton: Ti.UI.iPhone.SystemButton.TRASH,\r\n  top:10\r\n});\r\n\r\nbtn2.addEventListener(\"click\", resetImageView);\r\n\r\nvar btn3 = Ti.UI.createButton({\r\n  title: \"Start livePhoto\",\r\n  visible: false,\r\n  bottom:10\r\n});\r\n\r\nbtn3.addEventListener(\"click\", startLivePhoto);\r\n\r\nwindow.setRightNavButton(btn1);\r\nwindow.setLeftNavButton(btn2);\r\nwindow.add(btn3);\r\n\r\nnav.open();\r\n\r\nfunction openGallery() {\r\n  Ti.Media.openPhotoGallery({\r\n    mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_LIVEPHOTO],\r\n    success: function(e) {\r\n      var photo = e.media; // Static photo without motion of type Ti.Blob\r\n      var livePhoto = e.livePhoto // Live photo of type Ti.UI.iOS.LivePhoto\r\n\r\n      if(livePhoto) {\r\n        // Live photo supported and returned\r\n        view = Ti.UI.iOS.createLivePhotoView({\r\n          livePhoto: livePhoto,\r\n          muted: true,\r\n          width: 300\r\n        });\r\n\r\n        view.addEventListener(\"start\", function(e) {\r\n            Ti.API.warn(\"Start playback\");\r\n            Ti.API.warn(e);\r\n        });\r\n\r\n        view.addEventListener(\"stop\", function(e) {\r\n            Ti.API.warn(\"Stop playback\");\r\n            Ti.API.warn(e);\r\n        });\r\n\r\n      } else if(photo) {\r\n        // Default photo for iOS < 9.1\r\n        view = Ti.UI.createImageView({\r\n          image: photo\r\n        });\r\n      } else {\r\n        Ti.API.error(\"Fallback: Most probably tried to select a video (not part of this example).\");\r\n      }\r\n\r\n      btn3.setVisible(livePhoto != null);\r\n\r\n      window.add(view);\r\n    }\r\n  });\r\n}\r\n\r\nfunction resetImageView() {\r\n    if(!view) {\r\n        return;\r\n    }\r\n\r\n    window.remove(view);\r\n}\r\n\r\nfunction startLivePhoto() {\r\n    if(!view) {\r\n        return;\r\n    }\r\n\r\n    view.startPlaybackWithStyle(Ti.UI.iOS.LIVEPHOTO_PLAYBACK_STYLE_FULL);\r\n\r\n    view.setMuted(false);\r\n    setTimeout(function() {\r\n        view.stopPlayback();\r\n    }, 1000);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/comments/160735574","html_url":"https://github.com/appcelerator/titanium_mobile/pull/7479#issuecomment-160735574","issue_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7479","id":160735574,"user":{"login":"hansemannn","id":10667698,"avatar_url":"https://avatars.githubusercontent.com/u/10667698?v=3","gravatar_id":"","url":"https://api.github.com/users/hansemannn","html_url":"https://github.com/hansemannn","followers_url":"https://api.github.com/users/hansemannn/followers","following_url":"https://api.github.com/users/hansemannn/following{/other_user}","gists_url":"https://api.github.com/users/hansemannn/gists{/gist_id}","starred_url":"https://api.github.com/users/hansemannn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansemannn/subscriptions","organizations_url":"https://api.github.com/users/hansemannn/orgs","repos_url":"https://api.github.com/users/hansemannn/repos","events_url":"https://api.github.com/users/hansemannn/events{/privacy}","received_events_url":"https://api.github.com/users/hansemannn/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T19:36:46Z","updated_at":"2015-11-30T19:36:46Z","body":"@cheekiatng Scons'd & tested, ready to go!!"}}