Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Example: Publish Content to Sample News Library and Stream Published Content Using the Fabric

camgirl edited this page Nov 4, 2018 · 8 revisions
Install ruby on your Mac using brew install from the terminal

brew install ruby

Download qfab-cli and the supporting scripts (for MacOS; these binaries will not run on other OS's):

http://www.eluv.io/dl/mac/qfab_cli.tgz 
http://www.eluv.io/dl/scripts-ondemand.tgz

Unzip the tools into a directory of your choice and change directory into this directory.

From the command terminal, run qfab-cli as in the following example: 

$ bin/qfab_cli submit video --library ilib6bPNxKquEsYEmDtDdykqTY --name "Sample News - Big Buck Bunny" --description "Demonstration only" --source "~/Desktop/MEDIA/BBB/SampleVideo_720x480_20mb.mp4" --image "~/Desktop/MEDIA/THUMBNAILS/bbb.png" --scriptsdir ~/ELV2/MP/ondemand/ --type avmaster2000.imf --caddr 0x742d0e5a4ebc3df9fbe3388596b62efd73b01cae  --url http://q1.contentfabric.io

where :
--name is the name label you want the content to have in the fabric
--description is just descriptive data
--source is the path to an MP4 file you are contributing. (Note - while various video formats may work, just use .mp4 for this hackathon as it is known to work)

Leave all other parameters as shown.

A successful output will look something like this and say 'content finalized'

2018-11-04T07:04:37.287Z INFO  initialize cli            cfg=&{http://q1.contentfabric.io os <nil> info json - -} logger=/
{"fields":{"logger":"/","type hash":"hq__QmZJ1aqtK5LwDYRWZRM2u5d6HorgULxG9HtRE25koT1mGy","type name":"avmaster2000.imf"},"level":"info","timestamp":"2018-11-04T00:04:37.378071051-07:00","message":"submit.demo"}
{"fields":{"draft":{"Q":{"Id":"iq__X9Zy2qXgEhsoXb6jcJLcfi","Type":"hq__QmZJ1aqtK5LwDYRWZRM2u5d6HorgULxG9HtRE25koT1mGy","write_token":"tqw_CPYyNVcujhFCLGKNw6yd3uvXc7Uj7zE1v"},"Qlib":{"Id":"ilib6bPNxKquEsYEmDtDdykqTY"}},"logger":"/"},"level":"info","timestamp":"2018-11-04T00:04:37.521471035-07:00","message":"Draft Content Created"}
{"fields":{"error":"exit status 1","logger":"/","reason":"failed to create offerings"},"level":"error","timestamp":"2018-11-04T00:04:37.642457064-07:00","message":"submit.demo"}
Error: exit status 1
~/ELV2/content-fabric (bitcode-composition) $ bin/qfab_cli submit video --library ilib6bPNxKquEsYEmDtDdykqTY  --name "Big Buck Bunny 20 Mbps" --description "Demonstration only" --source /Users/michelle/Desktop/MEDIA/BBB/SampleVideo_720x480_20mb.mp4 --image /Users/michelle/Desktop/MEDIA/THUMBNAILS/bbb.png  --scriptsdir /Users/michelle/ELV2/MP/ondemand/ --type avmaster2000.imf --caddr 0x742d0e5a4ebc3df9fbe3388596b62efd73b01cae  --url http://q1.contentfabric.io
2018-11-04T07:07:25.401Z INFO  initialize cli            cfg=&{http://q1.contentfabric.io os <nil> info json - -} logger=/
{"fields":{"logger":"/","type hash":"hq__QmZJ1aqtK5LwDYRWZRM2u5d6HorgULxG9HtRE25koT1mGy","type name":"avmaster2000.imf"},"level":"info","timestamp":"2018-11-04T00:07:25.4356629-07:00","message":"submit.demo"}
{"fields":{"draft":{"Q":{"Id":"iq__Q7vwdKNzqqqecBHJ7AJYRJ","Type":"hq__QmZJ1aqtK5LwDYRWZRM2u5d6HorgULxG9HtRE25koT1mGy","write_token":"tqw_6VEBDhFNqVQcnZtm5NLYJWp4KvYAghHwB"},"Qlib":{"Id":"ilib6bPNxKquEsYEmDtDdykqTY"}},"logger":"/"},"level":"info","timestamp":"2018-11-04T00:07:25.450877729-07:00","message":"Draft Content Created"}
{"fields":{"Content":"id","iq__Q7vwdKNzqqqecBHJ7AJYRJ":"hash","logger":"/","unknown":"hq__Qme1BHjyHrM3kcPfTWSQHwefgx1tVMgd5t3HzL34mdbbrg"},"level":"info","timestamp":"2018-11-04T00:08:53.107301902-07:00","message":"submit.demo - content finalized"}
{"fields":{"dash manifest url":"http://q1.contentfabric.io/qlibs/ilib6bPNxKquEsYEmDtDdykqTY/q/hq__Qme1BHjyHrM3kcPfTWSQHwefgx1tVMgd5t3HzL34mdbbrg/rep/dash/en.mpd","logger":"/"},"level":"info","timestamp":"2018-11-04T00:08:53.10735606-07:00","message":"submit.demo"}

Now you can query this content in the library:

Find the line "dash manifest url" and use it but replace /rep/dash/en.mpd with /meta
"dash manifest url":"http://q1.contentfabric.io/qlibs/ilib6bPNxKquEsYEmDtDdykqTY/q/hq__Qme1BHjyHrM3kcPfTWSQHwefgx1tVMgd5t3HzL34mdbbrg/rep/dash/en.mpd"

For the above example, use:

curl http://q1.contentfabric.io/qlibs/ilib6bPNxKquEsYEmDtDdykqTY/q/hq__Qme1BHjyHrM3kcPfTWSQHwefgx1tVMgd5t3HzL34mdbbrg/meta | jq .

This will return the details of the content object you created in the fabric.

To stream the content in the browser, all you need to do is embed the DASH reference player in your web application and have it load the URL that is givnen in the dash manifest URL:

For example in the above case:
"http://q1.contentfabric.io/qlibs/ilib6bPNxKquEsYEmDtDdykqTY/q/hq__Qme1BHjyHrM3kcPfTWSQHwefgx1tVMgd5t3HzL34mdbbrg/rep/dash/en.mpd"

Here is a sample page describing the DASH reference player you can use to test, and with documentation for embedding the player in your web app:

http://reference.dashif.org/dash.js/v2.4.1/samples/dash-if-reference-player/index.html

If you replace the "stream URL" with your dash manifest url and choose load your stream will play from the fabric.  You will want to embed this player into your application.```