Skip to content

Instantly share code, notes, and snippets.

View gsemino's full-sized avatar

Glen S gsemino

View GitHub Profile
@gsemino
gsemino / html5video-SYNQ-sample.html
Last active June 1, 2017 23:29
SYNQ HTML5 video embed sample
<!DOCTYPE html>
<html>
<body>
<video width="1280" height="720" controls>
<!-- The source files used below are the mp4_720p and webm_720p output URLs provided by the SYNQ details API -->
<source src="https://multicdn.synq.fm/projects/fb/ec/fbec62099ed94d7ba7692c1234567891/derivatives/videos/3a/b5/3ab5226012e4483aa653b31234567891/mp4_720/3ab5226012e4483aa653b31234567891_mp4_720.mp4" type="video/mp4">
<source src="https://multicdn.synq.fm/projects/fb/ec/fbec62099ed94d7ba7692c1234567891/derivatives/videos/3a/b5/3ab5226012e4483aa653b31234567891/webm_720/3ab5226012e4483aa653b31234567891_webm_720.webm" type="video/webm">
Your browser does not support HTML5 video.
</video>
@gsemino
gsemino / details_sample_output.js
Created June 1, 2017 23:11
Sample SYNQ details API output
// Sample Details API JSON output
{
"input": {
"url": "https://multicdn.synq.fm/projects/fb/ec/fbec62099ed94d7ba7692c1234567891/uploads/videos/3a/b5/3ab5226012e4483aa653b31234567891.mp4",
"width": 3840,
"height": 2160,
"duration": 471.304,
"file_size": 238726667,
"framerate": 29.97,
"uploaded_at": "2017-05-30T23:03:57.012Z"
@gsemino
gsemino / userdata_query.js
Last active May 31, 2017 23:12
SYNQ userdata Query API example
//userdata query find all every where year is 2017 and the model name is c
if (video.userdata.cars)
{
if (video.userdata.cars[0]["year"] == 2017 &&
_.includes(video.userdata.cars[0].models, "c"))
{
return {"id":video.video_id, "cars_userdata": video.userdata.cars}
}
}
@gsemino
gsemino / userdata_update.js
Last active May 31, 2017 23:01
SYNQ userdata Update API sample calls
//this call will modify year from above to be 2017
video.userdata.cars[0]["year"]=2017
//this call will add the model 'slk' to the above sample
video.userdata.cars[0]["models"].push("slk")
//sample body response from Update API after above calls
{
"state": "created",
"userdata": {
@gsemino
gsemino / userdata_create.js
Last active May 31, 2017 22:44
Userdata creation examples for SYNQ's Create and Update API
//if using the Create API, to create an array of cars put this into 'userdata' field
{"cars": [{"make":"mercedes","year":2013, "models":["c","cls"]}]}
//if using the Update API, to create an array of cars put this in the 'source' field
video.userdata = {"cars": [{"make":"mercedes","year":2013, "models":["c","cls"]}]}
//sample body response from Update or Create API:
{
"state": "created",
"userdata": {
@gsemino
gsemino / queries.js
Last active May 8, 2017 16:23
Sample Queries for the SYNQ video Query API
/* search videos that have player views greater than 9000 and return the all the information for the videos that match
the query */
if (video.get("player.views") > 9000) { return video }
//search videos that have been uploaded and return only the video id
if (video.state == 'uploaded') { return {"video_id": video.video_id}; }
/* search videos that have been uploaded and where player views is greater than 1, return only the video id and
player embed url */
if (video.state == 'uploaded' && video.get("player.views") >= 1)
@gsemino
gsemino / html5video.html
Created April 28, 2017 18:02
simple html5 video example with mp4 and webm source
<!DOCTYPE html>
<html>
<body>
<video width="640" height="360" controls>
<source src="video_url.mp4" type="video/mp4">
<source src="video_url.webm" type="video/webm">
Your browser does not support HTML5 video.
</video>