{"id":1031,"date":"2016-12-19T13:02:55","date_gmt":"2016-12-19T13:02:55","guid":{"rendered":"http:\/\/sandjam.co.uk\/sandjam\/?p=1031"},"modified":"2018-08-03T13:50:29","modified_gmt":"2018-08-03T12:50:29","slug":"working-with-facebook-live","status":"publish","type":"post","link":"https:\/\/sandjam.co.uk\/sandjam\/2016\/12\/working-with-facebook-live\/","title":{"rendered":"Working with Facebook Live"},"content":{"rendered":"<p>I&#8217;ve spent some time recently working with the Facebook Live API and since this is a fairly new service which is being heavily promoted I thought it might be useful to share my experiences with it.<\/p>\n<p>The aim was to build a tool that would pop up a message on the website when a channel goes live, and allow users to stream the live video on the site to keep them engaged without diverting traffic away.<\/p>\n<h2>Graph API Query<\/h2>\n<p>The Facebook Graph API is really powerful and rich in the depth of data that can be queried. Live videos are included in the regular videos query with a new attribute called &#8220;live_status&#8221; returned for each video. These statuses aren&#8217;t well documented, but the possible values are:<\/p>\n<p>&#8220;LIVE&#8221; when a stream is currently live<\/p>\n<p>&#8220;VOD&#8221; when a video was live, and is still available to view<\/p>\n<p>I get the feeling that the graph API changes so rapidly that the documentation sometimes struggles to keep up. Several of the methods I had to figure out manually suing their Graph API explorer.<\/p>\n<h2>Embedding Video<\/h2>\n<p>This is where things get confusing&#8230; The query returns an attribute called &#8220;embed_html&#8221; but Facebook advise against using this and instead using their client JS library to embed the video via the ID. Unfortunately I found this to be unreliable &#8211; in one case even though the video was marked as &#8220;embeddable=true&#8221; the video showed an error when I tried to embed it saying &#8220;This video could not be embedded&#8221;. For this reason, I reverted to using the embed_html property.<\/p>\n<h2>Mobile Video<\/h2>\n<p>Unfortunately I discovered a limitation that live video cannot currently be embedded in iOS. Videos that <em>were<\/em> live can be streamed, and pre-recorded videos will stream. But not those that are live now. This is a shame, and is presumably something that Facebook will be working to fix soon but it&#8217;s an indication of how new this technology is.<\/p>\n<p>There is also the issue on iOS that affects all embedded video that you cannot auto-play video, so users must click on the video thumbnail before it will begin to play.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent some time recently working with the Facebook Live API and since this is a fairly new service which is being heavily promoted I thought it might be useful to share my experiences with it. The aim was to build a tool that would pop up a message on the website when a channel [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":1032,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4],"tags":[29,93,101,23],"class_list":["post-1031","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","tag-facebook","tag-jamie-oliver","tag-live-video","tag-social-networking"],"acf":[],"_links":{"self":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts\/1031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/comments?post=1031"}],"version-history":[{"count":3,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts\/1031\/revisions"}],"predecessor-version":[{"id":1037,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/posts\/1031\/revisions\/1037"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/media\/1032"}],"wp:attachment":[{"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/media?parent=1031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/categories?post=1031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandjam.co.uk\/sandjam\/wp-json\/wp\/v2\/tags?post=1031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}