This will require a Facebook account (with admin rights to a page if you broadcast through that page) as well as a Google account. We are going to create a Google Spreadsheet with an associated Google Apps Script that will run every week to schedule your live video.
- Create a Google Spreadsheet
- Under the Tools menu, click Script editor
- Into that new script paste the contents of this file
- Create a new Facebook App under the My Apps menu on developers.facebook.com
- Under Settings click on Basic and copy your App ID and App Secret (click Show) into the appropriate places back in your Google Script editor
- Setup gsuitedevs' OAuth2 library for Google Apps Script by following the four steps there
- Run the logRedirectUri function in your Google Script, then under the View menu click Logs, copy the Redirect URL (starting with http)
- On the Facebook developer page, set up Facebook Login for your app
- Under the Facebook Login Settings, paste in the OAuth Redirect URI that you copied earlier
- In your Google Script, run the scheduleLivestream function, this won't actually schedule anything yet but instead will log a URL for you to paste into your browser to authorize the script (under the View menu click Logs, or look at the original spreadsheet)
- Using the Facebook Graph API Explorer, add the following permissions to your app: pages_show_list, manage_pages, publish_pages, publish_video
- Run the Google Script function scheduleLivestream again and watch for any errors, if it successfully schedules a broadcast then you'll see a new line in your spreadsheet
- Add triggers to your Google Script: under the Edit menu click Current project's triggers
- Click Add Trigger and set the options:
- scheduleLivestream
- Head
- Time-driven
- Week timer
- Every Wednesday (or whatever you prefer)
- 1pm to 2pm (or whatever)
- then click Save
- Click Add Trigger and set the options:
- onOpen
- Head
- From spreadsheet
- On open
- then click Save
- In your Google Script, change the following lines:
- var status = 'SCHEDULED_UNPUBLISHED'; to var status = 'SCHEDULED_LIVE';
- var day = dateNow.getDate() + ((7 - dateNow.getDay()) % 7); to var day = dateNow.getDate() + ((9 - dateNow.getDay()) % 7); // for Tuesday
- var newDate = new Date(year, month, day, 10, 25); to the time you'd like to start the broadcast
- you can also change the var title line to whatever you'd like
- Run the scheduleLivestream function again to test, and to make sure everything has been authorized
- Check at some point after the Trigger time you set to make sure that the broadcast has been scheduled
No comments:
Post a Comment