Conversations API: Retrieve and submit consumer-generated content (CGC), and retrieve your product catalog and statistics about your CGC.
Hosted Video Display
Refer to Conversations PRR Only Features for more information.
The Conversations API lets you programmatically retrieve and submit Bazaarvoice Conversations data for use in your applications. To learn more, go to the Conversations API documentation home page.
Contents
This page explains how to display in HTML videos hosted by Bazaarvoice.
Overview
The Video
element within any returned content produces a URL that can be used to embed a video into HTML. When a piece of content has one or more videos associated with it, a Video
block is returned. The VideoUrl
value is the URL to be used to embed the video into HTML. The following shows the format of the Video
block.
"Results": [ { ... Videos: [ { VideoHost: "BAZAARVOICE", BvOwnerType: "review", BvOwnerId: "23437163", Caption: "video caption", PlayerId: "71119742001", VideoId: "1889268790001", Host: "reviews.testcustomer.bazaarvoice.com", Display: "0001", VideoThumbnailUrl: "http://testcustomer.ugc.bazaarvoice.com/0001/31180/videoThumb.jpg", VideoUrl: "http://c.brightcove.com/services/viewer/federated_f9?bvNoCustomization=true&publisherID=70985768001&isVid=true&playerID=71119742001&@videoPlayer=1889268790001&bvOwnerType=review&bvOwnerID=23437163", VideoIframeUrl: null } ], ... } ]
Embedding the video into HTML code
The following is an example of embedding the video into HTML. The values used in the object tag have been taken directly from the API response items. Each item has been attributed to the source value in the API response.
<h1>BazaarVoice HTML5 Plugin in Smart Player</h1> <!-- Start of Brightcove Player --> <div style="display:none"> </div> <!-- By use of this code snippet, I agree to the Brightcove Publisher T and C found at https://accounts.brightcove.com/en/terms-and-conditions/. --> <script type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script> <object id="myExperience" class="BrightcoveExperience"> <param name="bgcolor" value="#FFFFFF" /> <param name="width" value="640" /> <param name="height" value="360" /> <param name="playerID" value="71119742001" /> <!-- Value of the PlayerId response item --> <param name="isVid" value="true" /> <param name="dynamicStreaming" value="true" /> <param name="bvOwnerID" value="23437163" /> <!-- Value of the BvOwnerId response item --> <param name="bvOwnerType" value="review" /> <!-- Value of the BvOwnerType response item --> <param name="@videoPlayer" value="1889268790001" /> <!-- Value of the VideoId response item --> <param name="host" value="reviews.testcustomer.bazaarvoice.com" /> <!-- Value of the Host response item --> <param name="display" value="0001" /> <!-- Value of the Display response item --> </object> <!-- This script tag will cause the Brightcove Players defined above it to be created as soon as the line is read by the browser. If you wish to have the player instantiated only after the rest of the HTML is processed and the page load is complete, remove the line. --> <script type="text/javascript">brightcove.createExperiences();</script> <!-- End of Brightcove Player -->
Other considerations
The URL returned by the API is dynamic and should not be stored on the client-side. It is necessary to query each time the video is displayed.
Brightcove allows you to dynamically load the Video Cloud player via Javascript. If you're interested in using that method, be aware that any documentation they have on the subject does not include the BV specific params. For example, the BCL.playerTemplate
variable, which was supplied by BrightCove at the time of this writing, does not include the following params:
bvOwnerID
bvOwnerType
host
display
You will need to update this BCL.playerTemplate
to include those parameterized tags and update the object that is passed to your template markup generator.
When the API response is XML (e.g., after calling /data/reviews.xml
), the XML is encoded causing certain special characters (such as &) to be changed into entity references. Consequently, all ampersands (&) are encoded as &
. There are many tools/packages that will correctly decode the returned XML. For Java, the org.apache.commons.lang3
package contains StringEscapeUtils
which is commonly used for encoding/decoding (for further information, see org.apache.commons.lang3.StringEscapeUtils). There are equivalent packages in most languages.