Custom Data
Attach Custom Data to Recordings
You can attach custom data to each recorder, and, in turn, the data will be attached to all the recordings made with that recorder.
The custom data will be available in the Recordings list in your account dashboard and through the REST API, and it will be passed back to you through webhooks.
This is very useful when you wish to tunnel data - like a user id or a submission id - from your embed code all the way to your webhook receiving code. The custom data can be a simple string or a JSON object.
payload
property must not be longer than 500 characters.The image below shows the custom data attached to a recording visible in the Recordings list in the Pipe account dashboard. The custom data attached was “user-id:34149934”.
Sending a Simple String as Custom Data
Embed Code v2.0 via HTML
We will use the pipe-payload
attribute to attach custom data to the recordings made with this recorder.
Here’s how to add the pipe-payload
attribute to the <piperecorder>
tag. This is the default 2.0 HTML embed code:
<piperecorder id="custom-id" pipe-width="640" pipe-height="390" pipe-qualityurl="avq/360p.xml" pipe-accounthash="ACCOUNT_HASH" pipe-eid="ENVIRONMENT_ID" pipe-mrt="600" pipe-avrec="1"></piperecorder>
This is an embed code with the pipe-payload
attribute added:
<piperecorder id="custom-id" pipe-width="640" pipe-height="390" pipe-qualityurl="avq/360p.xml" pipe-accounthash="ACCOUNT_HASH" pipe-eid="ENVIRONMENT_ID" pipe-mrt="600" pipe-avrec="1" pipe-payload="your_payload_data_string"></piperecorder>
Embed Code v2.0 via JavaScript
We will use the JavaScript object’s payload
property to attach custom data to the recordings made with this recorder.
Here’s how to add the payload
property to your custom JavaScript object. This is the standard JavaScript object without the payload
property:
var pipeParams = {size:{width:640,height:390}, qualityurl:"avq/360p.xml", accountHash:"ACCOUNT_HASH", eid:"ENVIRONMENT_ID", mrt:600, avrec:1};
Here’s the same JavaScript object but with the payload
property added:
var pipeParams = {size:{width:640,height:390}, qualityurl:"avq/360p.xml", accountHash:"ACCOUNT_HASH", eid:"ENVIRONMENT_ID", mrt:600, avrec:1, payload:"your_payload_data_string"};
Embed Code v1.0
We will use flashvar
’s payload
property to attach custom data to the recordings made with this recorder.
Here’s how to add the payload
property to the flashvar
object. This is the default 1.0 embed code:
var flashvars = {qualityurl:"avq/360p.xml", accountHash:"ACCOUNT_HASH", eid:"ENVIRONMENT_ID", mrt:600, avrec:1};
This is an embed code with the payload
property added:
var flashvars = {qualityurl:"avq/360p.xml", accountHash:"ACCOUNT_HASH", eid:"ENVIRONMENT_ID", mrt:600, avrec:1, payload:"your_payload_data_string"};
Sending a JSON Object as Custom Data
To send a JSON object as custom data you’ll have to send it as a string through the:
pipe-payload
attribute (2.0 HTML embed code)- JavaScript object’s
payload
property (2.0 JS embed code) flashvar
’spayload
property (1.0 embed code)
You have two ways of sending the JSON correctly:
enclose the JSON in single quotes and write the JSON normally:
payload:'{"a":"b"}'
enclose the JSON in double quotes and escape the double quotes from inside the JSON
payload:"{\"a\":\"b\"}"
Receiving the Data
The custom data you’ve included in the embed code will be sent back to you with (all) the webhooks that fire for the events associated with the recordings made with that recorder. The data will be available as the value of the payload
property of the data
object.
Here’s the application/x-www-form-urlencoded
variant:
payload={
"version":"1.0",
"event":"video_converted",
"data":{
"videoName":"recording name here",
"duration":"7.56",
"audioCodec":"AAC",
"videoCodec":"H.264",
"type":"mp4",
"size":194373,
"width":"320",
"height":"240",
"orientation":"landscape",
"id":34745986,
"payload":"your_payload_data_string",
"dateTime": "2015-10-10 16:00:36",
"timeZone":"Europe/Bucharest"
}
}
Here’s the application/json
variant:
{
"version":"1.0",
"event":"video_converted",
"data":{
"videoName":"recording name here",
"duration":"7.56",
"audioCodec":"AAC",
"videoCodec":"H.264",
"type":"mp4",
"size":194373,
"width":"320",
"height":"240",
"orientation":"landscape",
"id":34745986,
"payload":"your_payload_data_string",
"dateTime": "2015-10-10 16:00:36",
"timeZone":"Europe/Bucharest"
}
}