Quantcast
Channel: Video Cloud Overview Recent
Viewing all 2356 articles
Browse latest View live

Changing Banners on Video Change

$
0
0
0

This topic describes how to use the Player API to change sponsorship logos and banners on your web page based on the currently playing video.

Even if you don't include ads with your videos, you may want to run promotions or show sponsor messages.

This solution, requires the following:

  • Access to the Brightcove Player API

Getting started with the basic code

Before you copy your player code from Video Cloud Studio, make sure you have enabled the player for ActionScript/JavaScript APIs in the Web Settings section.

Note: Your custom code for the Player APIs will fail silently if this player setting is not enabled.

You will start with the basic Player code embedded in an HTML document. The Player code can be copied from Video Cloud Studio. Here is an example of the Player code:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Banner Ad</title>
</head>
<body>
<!-- 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 language="JavaScript" 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="798" />
<param name="height" value="500" />
<param name="playerID" value="2534998063001" />
<param name="playerKey" value="AQ~~,AAABmA9XpXk~,-Kp7jNgisrcwtI9lRuX4UZaA6B6424B5" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />

</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 -->
</body>
</html>

To learn more about generating the Brightcove player code, refer to the Publishing a Video Cloud Player document.

Changing a sponsorship logo and banner based on video

With a little help from the Video Cloud Player API, you can change the logo and banner images in your web page. To do this, you will need to store the paths to your images in the video metadata. If you have a Professional or Enterprise account, you could create custom fields to hold this data. With an Express account, you can save the data in one of the standard fields, like the Long Description.

Changing the logo and banner for each video consists of the following:

  1. Store the banner image path in the video metadata
  2. Use the Player API to get the image paths for the current video and replace the logo and banner source
  3. Verify the sample code

Storing image paths in the video metadata

Return to Video Cloud Studio, navigate to the Media module and edit your video. In this example, we have stored the image paths in the Long Description field.

Note: This solution stores a JSON string in the Long Description field which represents an object with two properties: the URL for a logo image and the URL for a banner image.

Using the Player API to get image paths for the current video and replace the image source

In your HTML document, add JavaScript code to access the Player API to do the following:

  • Include the Player API event listeners
  • Add logo image and bottom banner image HTML tags
  • Create an onTemplateLoad() function that defines the player and the APIModules object
  • Create an onTemplateReady() function that defines the video player and adds an event listener for video change
  • Create an onChange() function that gets the image path URLs for the current video and sets the logo and banner HTML images

Note: To view the console messages in this solution, turn on the console using the browser's developer tools.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Banner Ad</title>
</head>
<body> <!-- top logo image -->
<img id="logoImage"/>
<br/>
<!-- Start of Brightcove Player -->
...
<object id="myExperience" class="BrightcoveExperience">
...
<!-- smart player api params -->
<param name="includeAPI" value="true" />
<param name="templateLoadHandler" value="onTemplateLoad" />
<param name="templateReadyHandler" value="onTemplateReady" />


</object>
...
<!-- End of Brightcove Player -->
<br/>
<!-- bottom banner image -->
<img id="bottomImage"/>
<!-- custom script -->
<script type="text/JavaScript">
var player,
APIModules,
videoPlayer,
logoImage,
bottomImage,
images;
var onTemplateLoad = function(experienceID){
console.log("EVENT: onTemplateLoad");
player = brightcove.api.getExperience(experienceID);
APIModules = brightcove.api.modules.APIModules;
};

var onTemplateReady = function(evt) {
console.log("EVENT.onTemplateReady");
videoPlayer = player.getModule(APIModules.VIDEO_PLAYER);
videoPlayer.addEventListener(brightcove.api.events.MediaEvent.CHANGE, onChange);
/* since there's no media change event for the loading of the
initial video, fire the media change handler manually */
onChange(null);
}

var onChange = function(evt) {
console.log("EVENT.onChange");
/*
get the long description for the current video and
parse it to create an object with two properties:
logo : URL for a logo image
bottomImage: URL for a banner image
*/
videoPlayer.getCurrentVideo( function(videoDTO) {
images = JSON.parse(videoDTO.longDescription);
console.log("Images for this video:");
console.log("logo image: " + images.logo);
console.log("bottom image: " + images.bottomImage);
/*
Set the source of the two images in the player to
images stored for the video in the long description field.
*/
document.getElementById("logoImage").src = images.logo;
document.getElementById("bottomImage").src = images.bottomImage;
});
}
</script>

</body>
</html>

Click here to view the complete sample page.

Running the sample code

Run the sample code in the browser. Select from the videos in the playlist to see the logo and banner ad change.


Changing Banners on Cue Points

$
0
0
0

This topic describes how to use the Player API to change sponsorship banners on your web page based on cue points.

Even if you don't include ads with your videos, you may want to run promotions or show sponsor messages.

This solution, requires the following:

  • Access to the Brightcove Player API

Getting started with the basic code

Before you copy your player code from Video Cloud Studio, make sure you have enabled the player for ActionScript/JavaScript APIs in the Web Settings section.

Note: Your custom code for the Player APIs will fail silently if this player setting is not enabled.

You will start with the basic Player code embedded in an HTML document. The Player code can be copied from Video Cloud Studio. Here is an example of the Player code:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Banner Ad</title>
</head>
<body>
<!-- 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 language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
<object id="myExperience2536252471001" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="500" />
<param name="height" value="470" />
<param name="playerID" value="2536261715001" />
<param name="playerKey" value="AQ~~,AAABmA9XpXk~,-Kp7jNgisrfZZvyM52KpOjFOurIQgeeD" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />

<param name="@videoPlayer" value="2536252471001" />

</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 -->
</body>
</html>

To learn more about generating the Brightcove player code, refer to the Publishing a Video Cloud Player document.

Changing a sponsorship banner based on cue points

With help from the Video Cloud Player API, you can use cue points to trigger a change to the sponsorship banner on your HTML page. This involves adding cue points to a video and setting an image URL in the Metadata field for each cue point. Using the Video Cloud Player API, you will add an event listener for the cue points and reset the source of the banner image with the URL from the cue point Metadata field.

Changing the banner based on cue points consists of the following:

  1. Store the banner image path in the cue point Metadata field
  2. Use the Player API to get the image path for the current cue point and replace the banner source
  3. Verify the sample code

Storing image paths for each cue point

Return to Video Cloud Studio, navigate to the Media module and edit your video. Add one or more cue points with the URL for your banner image in the Metadata field.

Using the Player API to get the image path for each cue point and setting the image source.

In your HTML document, add JavaScript code to access the Player API to do the following:

  • Include the Player API event listeners
  • Add a bottom banner image HTML tag
  • Create an onTemplateLoad() function that defines the player and the APIModules object
  • Create an onTemplateReady() function that defines the video player and adds an event listener for cue points
  • Create an onCue() function that gets the image path URL for the current cue point and sets the banner HTML source

Note: To view the console messages in this solution, turn on the console using the browser's developer tools.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Video Loop</title>
</head>
<body>
<!-- Start of Brightcove Player -->
...
<object id="myExperience2536252471001" class="BrightcoveExperience">

<!-- smart player api params -->
<param name="includeAPI" value="true" />
<param name="templateLoadHandler" value="onTemplateLoad" />
<param name="templateReadyHandler" value="onTemplateReady" />

</object>
...
<!-- End of Brightcove Player -->
<br/>
<!-- bottom banner image -->
<img id="bottomImage"/>
<!-- custom script -->
<script type="text/JavaScript">
var player,
APIModules,
videoPlayer,
cuePoints,
image;
var onTemplateLoad = function(experienceID){
console.log("EVENT: onTemplateLoad");
player = brightcove.api.getExperience(experienceID);
APIModules = brightcove.api.modules.APIModules;
};

var onTemplateReady = function(evt) {
console.log("EVENT.onTemplateReady");
cuePoints = player.getModule(APIModules.CUE_POINTS);
cuePoints.addEventListener(brightcove.api.events.CuePointEvent.CUE, onCue);
}

var onCue = function(evt) {
console.log("EVENT.onCue");
image = evt.cuePoint.metadata;
console.log("Image for this cue point: " + image);
document.getElementById("bottomImage").src = image; }
</script>

</body>
</html>

Click here to view the complete sample page.

Running the sample code

Run the sample code in the browser. You will see the banner ad change as each cue point is reached.

Player Publishing Code Options

$
0
0
Short Description: 
Learn about the different types of player publishing code that can be generated from Video Cloud Studio.
Video ID: 
2567927573001
Thumbnail URL: 
http://brightcove01.brightcove.com/23/20318290001/201307/1220/20318290001_2567951535001_Player-Publishing-Code-Options.jpg?pubId=20318290001
Still Image URL: 
http://brightcove01.brightcove.com/23/20318290001/201307/2220/20318290001_2567951536001_Player-Publishing-Code-Options.jpg?pubId=20318290001
Duration: 
4:22
Modified Date (Studio): 
1374864991917
Published Date (Studio): 
1374860024752

Video Encoding Best Practices

$
0
0
SFDC ID: 
501a0000000f9fQAAQ
Weight: 
0
When uploading content to your Video Cloud account, optimising your source video for transcoding will produce the best output results. We have documentation on our recommended best practices, available here:


However, you or your video team may wish to see some more specific recommendations, and some great (although by no means definitive) encoding settings are as follows:

Video:
  • Codec: H264, MP4 file extension
  • Bitrate: between 1.5 and 2.5Mbps if you intend to use the source as a rendition; 6 to 9Mbps otherwise
  • Bitrate mode: Preferably constant (ideal for a smooth streaming experience), or constrained VBR, without significant spikes
  • Encoding profile: Main@L3.0 or 3.1
  • Framerate: constant (this is very important), ideally 25 or 30fps
  • Reference frames: 1 or 2
  • Frame size: 1920x1080 to enable full HD transcoding. This should be square pixels and not anamorphic (i.e. 1440x1080)
  • Scan type: Progressive. We do not deinterlace, so please ensure that's performed beforehand, if applicable

Audio:
  • Codec: AAC or AAC-LC
  • Channels: 2 channel stereo
  • Bitrate: 128 or 256kbps VBR
  • Sampling rate: 44.1KHz (Flash always downsamples on-the-fly from 48KHz to 44.1, so encoding to 44.1 to start will reduce CPU load a little for the viewer).

Please also ensure that there is no delay being inserted into either the audio or video track (or both). Lastly, there should be only 1 video and 1 audio track. Some encoders add menu tracks, sometimes for tracking edit lists or other metadata, and this can cause encoding failures or unexpected results. This is often the case if you choose to "Save" directly from QuickTime Pro as opposed to exporting for delivery.
Modified date Salesforce: 
Monday, July 29, 2013 - 10:42

Activating and Deactivating Videos

$
0
0
Short Description: 
Learn about activating and deactivating videos inside of the Media module.
Video ID: 
2572564790001
Thumbnail URL: 
http://brightcove01.brightcove.com/23/20318290001/201307/2075/20318290001_2572598306001_Activating-and-Deactivating-Videos.jpg?pubId=20318290001
Still Image URL: 
http://brightcove01.brightcove.com/23/20318290001/201307/395/20318290001_2572598624001_Activating-and-Deactivating-Videos.jpg?pubId=20318290001
Duration: 
2:45
Modified Date (Studio): 
1375112933919
Published Date (Studio): 
1375111677980

Responsively Resizing the Player

$
0
0
0

This topic describes how to create a responsive video player and covers the following solutions:

  • Create a responsive player using an intrinsic ratio
  • Control the size of your responsive player
  • Calculate the intrinsic ratio to avoid letterboxing
  • Create a responsive player in HTML mode

When you use a fixed width and height for your video player, it will not resize with the browser.

In this topic, you will learn how to use the padding property to create a video player that resizes as the browser changes dimensions.

If your video is a non-standard size, you will see letterboxing.

In this topic, you will learn how to use the video's width and height to set the aspect ratio to avoid letterboxing.

Getting started with the basic code

You will start with the basic Player code embedded in an HTML document. The Player code can be copied from Video Cloud Studio. Here is an example of the Player code:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Responsive Player</title>
</head>
<body>
<!-- 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 language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>

<object id="myExperience1754276206001" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="480" />
<param name="height" value="270" />
<param name="playerID" value="1753810340001" />
<param name="playerKey" value="AQ~~,AAABmA9XpXk~,-Kp7jNgisrdihurn3hYnYJWo8k_gM6uF" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />

<param name="@videoPlayer" value="1754276206001" />
</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 -->
</body>
</html>

To learn more about generating the Brightcove player code, refer to the Publishing a Video Cloud Player document.

Creating a responsive video player using an intrinsic ratio

In this solution, you will use an intrinsic ratio, which is a CSS technique to fluidly constrain a child element to a ratio set in their parent element. To do this, you will add a <div> container around the video player and set the padding-bottom property with the desired aspect ratio for the video.

The padding property is the magic that styles a box with an intrinsic ratio. This is because the padding property is set as a percentage of the width of the containing block. It works well since padding styles are supported in all major browsers.

Note: This solution is borrowed from a blog post by Thierry Koblentz. For more details about browser compatibility, refer to his blog post.

Creating a responsive video player consists of the following:

  1. Add a parent container around the video player and style it with an intrinsic ratio
  2. Verify the sample code

Creating a parent container with an intrinsic ratio

In your HTML document, add HTML and CSS code to do the following:

  • Add a <div> container around the video player.
  • Style the outer container with the padding-bottom property set to a percentage to control its size. The percentage determines the height of the element based on its parent's width.
  • Note: To determine the percentage for a video with a 16:9 aspect ratio, divide 9 by 16 (i.e. 9/16 = .5625) to get 56.25%. For a 16:9 video, you want the height to be 9/16ths of the width.

  • Style the video player to fill the outer container

Note: A text block has been added above and below the video player to demonstrate how the player would appear in a real web page.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Responsive Player</title>
<style type="text/css">
.outer-container {
position: relative;
padding-bottom: 56.25%;
}
.BrightcoveExperience {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit amet, ...</p> <br />

<div id="container1" class="outer-container">


<!-- Start of Brightcove Player -->
...
<!-- End of Brightcove Player -->
</div>

<p>Lorem ipsum dolor sit amet, ...</p>

</body>
</html>

Click here to view the complete sample page.

Running the sample code

Run the sample code in the browser. Resize the browser to see how the video player resizes.

Controlling the size of your responsive video player

Notice that in the previous solution, the video player width extended to the full width of the browser. You can control the width of your player by adding another bounding container.

Controlling the size of your player consists of the following:

  1. Add another bounding container around the video player
  2. Verify the sample code

Adding a bounding container

In your HTML document, add HTML and CSS code to do the following:

  • Add a <div> container around the outer-container <div> block.
  • Style the containing-block container with the width property set to a percentage to control its size.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Responsive Player2</title>

<style type="text/css">
.containing-block {
width: 75%;
}
.outer-container {
position: relative;
padding-bottom: 56.25%;
}
.BrightcoveExperience {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>

</head>

<body>

<p>Lorem ipsum dolor sit amet, ...</p>

<br />

<div class="containing-block">
<div class="outer-container">

<!-- Start of Brightcove Player -->

...
<!-- End of Brightcove Player -->

</div>
</div>

<p>Lorem ipsum dolor sit amet, ...</p>


</body>
</html>

Click here to view the complete sample page.

Running the sample code

Run the sample code in the browser. Resize the browser to see how the video player resizes. Notice that the video player is only 75% of the width of the browser.

Calculating the intrinsic ratio to avoid letterboxing

Using a non-standard video size can cause letterboxing. This video has an intrinsic ratio of 53%. Since it does not fit the standard 16:9 aspect ratio (56.25%), it causes letterboxing.

Note: You can find the video's width and height in the Brightcove Media module to compute the intrinsic ratio. (i.e. 212/400 = .53 or 53%)

By using the Smart Player API, you can get the dimensions of the video and set the video size.

Controlling the size of your player consists of the following:

  1. Enable your player for ActionScript/JavaScript APIs.
  2. Use the Smart Player API to get the width and height of the video and calculate the percentage for the padding-bottom property.
  3. Verify the sample code

This solution, requires the following:

  • Access to the Brightcove Player API

Enabling your player for ActionScript/JavaScript APIs

In Video Cloud Studio, make sure you have enabled the player for ActionScript/JavaScript APIs in the Web Settings section.

Note: Your custom code for the Player APIs will fail silently if this player setting is not enabled.

Calculating the aspect ratio percentage

In Video Cloud Studio, make sure you have enabled the player for ActionScript/JavaScript APIs in the Web Settings section.

In your HTML document, add JavaScript code to access the Player API to do the following:

  • Include the Player API event listeners.
  • Create an onTemplateLoad() function that defines the player and the APIModules object.
  • Create an onTemplateReady() function that defines the video player and the experience module. Get the width and height for the current video rendition and use these values to calculate the intrinsic ratio.

Note: To view the console messages in this solution, turn on the console using the browser's developer tools.

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Responsive Player3</title>

<style type="text/css">
.containing-block {
width: 75%;
}
.outer-container {
position: relative;
padding-bottom: 56.25%;
}
.BrightcoveExperience {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>

</head>

<body>

<p>Lorem ipsum dolor sit amet, ...</p>

<br />

<div id="container2" class="containing-block">
<div id="container1" class="outer-container">

<!-- Start of Brightcove Player -->
...
<!-- smart player api params -->
<param name="includeAPI" value="true" />
<param name="templateLoadHandler" value="onTemplateLoad" />
<param name="templateReadyHandler" value="onTemplateReady" />
</object>

...
<!-- End of Brightcove Player -->

</div>
</div>

<p>Lorem ipsum dolor sit amet, ...</p>

<script type="text/javascript">
var player,
APIModules,
videoPlayer,
experienceModule;

function onTemplateLoad(experienceID){
console.log("EVENT: onTemplateLoad");
player = brightcove.api.getExperience(experienceID);
APIModules = brightcove.api.modules.APIModules;
}

function onTemplateReady(evt){
console.log("EVENT.onTemplateReady");
videoPlayer = player.getModule(APIModules.VIDEO_PLAYER);
experienceModule = player.getModule(APIModules.EXPERIENCE);
videoPlayer.play();

videoPlayer.getCurrentRendition( function (renditionDTO) {
var newPercentage = ( renditionDTO.frameHeight / renditionDTO.frameWidth ) * 100;
newPercentage = newPercentage + "%";
console.log("Video Width = "+renditionDTO.frameWidth+" and Height = "+renditionDTO.frameHeight);
console.log("New Percentage = "+newPercentage);
document.getElementById("container1").style.paddingBottom = newPercentage;
});
}

</script>

</body>
</html>

Click here to view the complete sample page.

Running the sample code

Run the sample code in the browser. Notice that the new percentage is calculated from the actual height and width of the video which eliminates letterboxing.

Creating a responsive player in HTML mode

Your video plays in an iframe when in HTML mode. In this section, you will learn how to resize a video contained in an iframe.

Using a parent container with the intrinsic ratio while in HTML mode, you will notice that the player container resizes but the actual video does not.

To resize your video in HTML mode, you must change the size of the iframe. You can do this by using the setSize() method.

Resizing your player in HTML mode consists of the following:

  1. Use the Smart Player API to get the computed width and height of the video and reset the size of the iframe.
  2. Verify the sample code

This solution, requires the following:

  • Access to the Brightcove Player API

Resetting the iframe size

In Video Cloud Studio, make sure you have enabled the player for ActionScript/JavaScript APIs in the Web Settings section.

In your HTML document, add JavaScript code to access the Player API to do the following:

  • Include the forceHTML player parameter to force HTML mode.
  • Note: The forceHTML parameter should only be used for testing.

  • Include the Player API event listeners.
  • Create an onTemplateLoad() function that defines the player and the APIModules object.
  • Create an onTemplateReady() function that defines the video player and the experience module.
  • Create an window.onresize() function that gets the computed width and height for the video player. These values are passed to the experience module's setSize() method to resize the iframe.
  • Programmatically dispatch a window.resize event. This causes the onresize method to be called on application startup. This must be done or on startup the iframe will not be the correct size. The last three lines of code of the onTemplateReady event handler use JavaScript to perform this task.
  • Note: Use the id value in the object tag for your player to get the computed width and height values.

Note: To view the console messages in this solution, turn on the console using the browser's developer tools.

<script type="text/javascript">
var player,
APIModules,
videoPlayer,
experienceModule;

function onTemplateLoad(experienceID) {
console.log("EVENT: onTemplateLoad");
player = brightcove.api.getExperience(experienceID);
APIModules = brightcove.api.modules.APIModules;
}

function onTemplateReady(evt) {
console.log("EVENT.onTemplateReady");
videoPlayer = player.getModule(APIModules.VIDEO_PLAYER);
experienceModule = player.getModule(APIModules.EXPERIENCE);
videoPlayer.play();

videoPlayer.getCurrentRendition(function(renditionDTO) {
var newPercentage = (renditionDTO.frameHeight / renditionDTO.frameWidth) * 100;
newPercentage = newPercentage + "%";
console.log("Video Width = " + renditionDTO.frameWidth + " and Height = " + renditionDTO.frameHeight);
console.log("New Percentage = " + newPercentage);
document.getElementById("container1").style.paddingBottom = newPercentage;
var evt = document.createEvent('UIEvents');
evt.initUIEvent('resize',true,false,0);
window.dispatchevent(evt);
});
}

window.onresize = function(evt) {
console.log("in resize function");
var resizeWidth = document.getElementById("myExperience1754276221001").offsetWidth,
resizeHeight = document.getElementById("myExperience1754276221001").offsetHeight;
experienceModule.setSize(resizeWidth, resizeHeight);
}
</script>

Click here to view the complete sample page.

Running the sample code

Run the sample code in the browser. Resize the browser to see how the video player resizes.

How to access HLS renditions with the Media API

$
0
0
SFDC ID: 
501a0000000fAFTAA2
Weight: 
0

The default video fields returned by the Media API's read methods includes a renditions array, but if using the default fields you will not find the HLS renditions listed in the returned renditions array.


You can access the individual HLS renditions by requesting the IOSRenditions field. You can also request the master playlist with the HLSURL field.


Example request
http://api.brightcove.com/services/library?command=find_video_by_id&token=TOKEN-WITH-URL-ACCESS&video_id=1234567890001&video_fields=id,HLSURL,IOSRenditions


Example response

{
    "id": 1234567890001,
"HLSURL": "http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoId=1234567890001&pubId=900000040001",
"IOSRenditions": [
        {
            "audioOnly": false,
            "controllerType": "DEFAULT",
            "displayName": "big_buck_bunny_480p_h264.mov",
            "encodingRate": 1120000,
            "frameHeight": 480,
            "frameWidth": 852,
            "id": 1234567891234,
            "referenceId": null,
            "remoteStreamName": null,
            "remoteUrl": null,
            "size": 94067904,
            "uploadTimestampMillis": 1372677286227,
"url": "http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1234567895678",
"videoCodec": "H264",
            "videoContainer": "M2TS",
            "videoDuration": 596416
        },
        {
            "audioOnly": true,
            "controllerType": "DEFAULT",
            "displayName": "big_buck_bunny_480p_h264.mov",
            "encodingRate": 64000,
            "frameHeight": 0,
            "frameWidth": 0,
            "id": 1234567895678,
            "referenceId": null,
            "remoteStreamName": null,
            "remoteUrl": null,
            "size": 4710893,
            "uploadTimestampMillis": 1326966856645,
"url": "http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1234567895678",
"videoCodec": "H264",
            "videoContainer": "M2TS",
            "videoDuration": 596288
        },
        {
            "audioOnly": false,
            "controllerType": "DEFAULT",
            "displayName": "big_buck_bunny_480p_h264.mov",
            "encodingRate": 608000,
            "frameHeight": 360,
            "frameWidth": 636,
            "id": 1234567893456,
            "referenceId": null,
            "remoteStreamName": null,
            "remoteUrl": null,
            "size": 52030464,
            "uploadTimestampMillis": 1372677331165,
"url": "http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1234567893456",
"videoCodec": "H264",
            "videoContainer": "M2TS",
            "videoDuration": 596416
        }
    ]
}
Modified date Salesforce: 
Tuesday, August 6, 2013 - 11:33

Checking when FTP Batch Upload is Complete

$
0
0
-81

When you are using FTP batch provisioning to upload videos to Video Cloud, you may want to be notified when the upload is complete. You can get notification by email, or you can use the callback feature, which sends upload notifications to the URL you specify.

FTP batch provisioning follows this process:

Pay special attention to the notes in the diagram. Often troublesome are the points that the media uploads must complete before the XML is uploaded, and the callback does NOT mean all renditions are transcoded, just that the process has started.

Using the callback feature

To use the callback feature, include a <callback> element in the manifest file for your FTP batch upload. The <callback> element is a child of the top-level publisher-upload-manifest element. It has a single attribute, entity-url, whose value is the URL you want the upload status posted to.

Example

<callback entity-url="http://example.com/batch-callback.php"/>

You will receive notification only of failures, not successes, unless you have set the attribute report-success="true" in the publisher-upload-manifest tag of your manifest.

Note that HTTP callback endpoints must return HTTP 200 if the request was ok. Other "success" codes such as HTTP 202 are not supported by our callback system.

HTTP Callbacks

Each time a tag is executed in a manifest, the Video Cloud system initiates a POST request, just like when you submit a form, and sends it to the URL you specified in the manifest. The following key/values (form data) are sent in the request:

KeyValue
referenceIdthe reference id provided in the manifest
idthe id of the video, playlist, or asset in the database
entityVIDEO, LINEUP (playlist), or ASSET
actionCREATE, DELETE, or UPDATE
statusFAILED or SUCCESS
errorAn error message

Handling the POST Request

When the data arrives, you need to do something with these values. Any server side language will likely be able to function as a listener for these requests.

The most common actions to take would be to append these values to a log file, insert these values as a row in a database, or send an email that contains the same information. In this example, we'll use a PHP script to listen for these values and then write them to a log file. You can download a zip file that includes the PHP script.

Here is a snippet from the code to show you exactly what is happening

<?php

// Begin by checking to see if "referenceId" is included in the POST request.
// If it is, assign its value to the $referenceId Variable.
// If it is not, assign the value of null to $referenceId.

if(isset($_POST["referenceId"])) {
    $referenceId = $_POST["referenceId"];
} else {
    $referenceId = null;
}

/* Repeat the same code for each key in the request */

// Next build a string that constrains the current date and time as well as
// the value for each key that was included in the request separated by
// a comma so that it can easily be imported as a CSV file.
//
$logEntry = date("m-d-y H:i:s") . ": " .
            $referenceId . "," .
            $id . "," .
            $entity . "," .
            $action . "," .
            $status . "," .
            $error .
            "\n";

// Lastly, tell PHP where it can find the log file and tell PHP to open it
// and add the string we created earlier to it.

$logFileLocation = "log.txt";
$fileHandle = fopen($logFileLocation, 'a') or die("-1");
fwrite($fileHandle, $logEntry);
fclose($fileHandle);

?>

This will result in a log file that looks like this:

06-04-11 17:42:34: 123456789ref,123456789,VIDEO,CREATE,FAILED, (continued)
This failed because it was just a test
06-04-11 17:42:35: 123456790ref,123456790,VIDEO,CREATE,FAILED, (continued)
This failed because it was just a test
06-04-11 17:42:36: 123456791ref,123456791,VIDEO,CREATE,FAILED, (continued)
This failed because it was just a test
06-04-11 17:42:37: 123456792ref,123456792,VIDEO,UPDATE,SUCCESS,
06-04-11 17:42:40: 123456793ref,123456793,VIDEO,UPDATE,SUCCESS,
06-04-11 17:42:41: 123456794ref,123456794,VIDEO,DELETE,SUCCESS,
06-04-11 17:42:42: 123456795ref,123456795,VIDEO,DELETE,SUCCESS,

 


Multi-Bitrate Rendition Switching Logic

$
0
0
-8

This document details the player multi-bitrate rendition switching logic for streaming and progressive download delivery.

Rendition switching logic for streaming video delivery

The Video Cloud multi-bitrate streaming feature improves a viewer's experience by enabling you to deliver videos with the resolution and bit rate that best matches the viewer's screen resolution and connection speed. When you upload your video and select multiple renditions, Video Cloud creates a collection of renditions encoded at different bit rates and sizes. Video Cloud Pro and Enterprise publishers have fine-grained control over the settings for each rendition, including codec, codec profile, video and audio bit rate, width and height, frame rate, and more. Video Cloud Express publishers have a standard set of rendition specs. When your video plays, the player selects and adjusts which rendition of your video to show according to Video Cloud's rendition switching logic. For general information about multi-bitrate streaming renditions, see Using Multi-bitrate Streaming. For instructions on setting the size, bit rate, and encoding options for your renditions, see Setting Your Transcode Options.

Here are some details about the Video Cloud rendition switching logic for streaming video delivery.

Selecting from qualifying renditions

The player chooses the highest bitrate rendition that is not more than 85% of the viewer's detected bandwidth. For example, say the player detects a viewer's bandwidth of 500 kbps, then we determine that 85% of the bandwidth is 425 kbps. The player also considers the aspect ratio of the rendition compared to the video display area to find a good match.

If the player is unable to detect the available bandwidth:

  • For Flash: the rendition whose bit rate is closest to 704 kbps
  • For HTML on iOS: the rendition closest to 256kbps will be selected and played without rendition selection, unless the video has HLS renditions

In our example, the player looks for the rendition with the greatest bandwidth at 425 kbps or under.

OrderWidth x HeightVideo Bit Rate (kbps)
1480x360436
2400x300110
3400x300260
4640x480704
5720x5401072

 

Those with a bit rate of 425 kbps and under include renditions #2 and #3. The player selects rendition #3, the 400x300, 260 kbps rendition, because it has the highest bandwidth of the two, and works backwards from there, serving rendition #2 if the playback quality with rendition #3 is not good.

Blacklisting renditions

It is possible renditions can be blacklisted, meaning they will not be available for playback. Three factors determine if a rendition is blacklisted:

  1. A ratio is calculated by dividing the asset area by the viewport, called the area ratio. If this ratio is less than 1 (the asset is smaller than the viewport), the rendition is blacklisted
    • This is done to avoid scaling a video up, which results in poor quality and more processing.
    • If all renditions are less than 1, the nearest to 1 will be used.
  2. If a rendition drops 33% of its frames two times during playback, or one time if the video is under 90 seconds, the rendition is blacklisted.
    • The 33% drop must occur twice instead of once in case the user was involved in a high CPU utilization activity which caused the dropped frames, and the rendition would be blacklisted unnecessarily
    • This occurs only if smoothing is off.
  3. Blacklisting occurs on a per screen size basis. For example, renditions blacklisted at full screen will not be blacklisted at a smaller screen size and vice versa. A rendition has to fail at a specific screen size to be blacklisted for that screen size.

If excessive frames are dropped on all non-blacklisted renditions, renditions with an area ratio less than 1 will be used.

When does the player switch renditions?

The player can run through non-blacklisted renditions using switching logic at the following times:

  • A new video is loaded into the player.
  • The video display size changes (entering/exiting full screen or through the Player APIs) for RTMP (Adobe FMS) or Akamai HD streams.
  • The player determines a change in playback quality, based (for RTMP (Adobe FMS) streams) on buffering, currently detected bandwidth, or the number of frames dropped, or as determined by the Akamai HD plug-in for Akamai HD streams.

Rendition switching logic for HTML players

This is what our HTML player checks, in the order that things are done.

  1. If the player can play back HLS[1] and the video has a controllerType of HD2 or HD2 Live, then the player uses the array of renditions to generate a URL used by Akamai for HLS playback.
  2. If the player can play back HLS[1] and it has an HLS URL, then it uses the first HLS URL it sees for playback. Looking for an HLS URL is done by looking at FLVFullLengthURL first, which is used if it has ".m3u8" within it. Otherwise, the renditions array is searched for a defaultURL that has ".m3u8" within it.
  3. The player searches through FLVFullLengthURL and the array of renditions (grabbing defaultURL from each one) to find a progressively-downloaded (PD) URL that can be played back. A PD URL that can be played back is decided by it having a videoCodec of "H264", a non-null defaultURL, and a defaultURL that does not have ".m3u8" within it. It chooses the one that has the encodingRate that is closest to 256000 bits per second.
  4. The player doesn't pick a URL for playback.

[1]: We select, based on our own testing, the devices that can play back HLS. Currently this includes all iOS devices, the Kindle Fire, Mac Safari 10.6+, and Android 4.2. We will also play back HLS on Android 4.0 or 4.1 if no non-HLS URLs are available.

Rendition selection for progressive download

Video Cloud will calculate the viewer's initial bandwidth and select the best rendition to deliver based on that. It is possible to customize the player behavior using the setRenditionSelectionCallback method in the Flash-only Player API, as described in Selecting Multi-Bitrate Streaming Renditions.  

Controlling rendition switching using the Flash-only Player API

The Video Cloud Flash-only Player API allows you to influence rendition selection by using the setRenditionSelectionCallback() method to set higher quality or lower quality renditions to load by default in a player or to create controls to allow viewers to switch between renditions. For further information on programming rendition behavior using the Flash-only Player API, see Selecting Multi-Bitrate Streaming Renditions. For instructions and samples on creating a custom rendition switcher for your viewers to set video quality during playback, see the Brightcove Open Source project, Rendition Selector Plugin.

Placing a Message Before & After a Live Stream

$
0
0
0

This document references code that shows how use the Smart Player API to check to see if a live stream is playing. If it is not, the code displays HTML in a <div> element with a message indicating the live stream has not started. Also, once the video has completed, a different message is displayed in the <div>.

Details on functionality

If users are pointed to a coming live event an empty player is displayed. The code below improves this experience by providing the following until the live stream starts:

Also, the following is displayed when the live stream ends (a complete event is dispatched):

Of course, any HTML of your choice can be placed into the <div> element.

Using the code

Below is the code. You will of course need to change the code to reflect your live stream, including:

  • playerID
  • playerKey
  • @videoPlayer

These values can be obtained from the player publishing code that will be used to publish the live event player.

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#placeholder {
width:480px;
height:270px;
}
#overlay {
position:absolute;
z-index: 10;
width:480px;
height:270px;
background-color: #000;
text-align: center;
}

.BrightcoveExperience {
position: absolute;
}
#message {
color: #FFF;
padding: 20px;
text-transform: uppercase;
font-size: 2em;
}
</style>
</head>
<body>

<div id="placeholder">
<div id="overlay"> <!-- MESSAGE SHOWN BEFORE STREAM -->
<p id="message">Video is not yet live</p>
<img id="progress" src="data:image/gif;base64,R0lGODlhWgALAIQAAJyanMzOzPTy9KyqrNze3NTW1Pz6/LSytKSmpJyenNTS1PT29KyurOTm5Nza3Pz+/LS2tAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQIBwAAACwAAAAAWgALAAAF8CAgjsFjntAoIsJpNqpYuk+qsjQcz6494i6darajGXyrVjAG4JmOMeBJSDIiAdIXkzdcuKA35YmQ2HlP4J/YRDZ/r9lHu3uqfg/R9cNRHhrxYTR8RXd5gn12dU00D4BqNHOJJ45JkIgyjJRYepGYNItfDFFnY1tGojekbKaho5CsaAcONAuaCKp7TAW0trgOuryuLr8xuy61AMGpNAqXAMYnyMsuzcXKP7jVKtAm0l8DMQzZztwPBuAq4szkRugj6tTs3yPR7iLwJ8TbtPYA+Cb6RpRb0O9fLmvH7HXrd4sZsITCTih4WC+iiYkIK6oIAQAh+QQIBwAAACwAAAAAWgALAIScmpzMzszs6uy0trSsqqzc3tz09vTExsSkoqTU1tT08v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EF03CDQAk3t0UJyeoIKieCmdjYeoNyUMSgxMphAHorE3szq1tzS5MbtCvbhKAMAqq8M3vi3IqrTMxaS80r9KCAU3CcouDzcL0yrcTN8x4dcx5DrmKujO252y5eDiKsLe9enB9Of2KbtuCIgW44CCfSoGVit4EJ5AgioMIkyhEEAIACH5BAgHAAAALAAAAABaAAsAhJyanMzOzLS2tOzq7KyqrNze3MTCxPT29KSipNza3Ly+vPTy9OTm5MzKzPz+/JyenNTS1Ly6vOzu7LSytOTi5MTGxPz6/KSmpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX+4IAAJKk4aGqU5DOkqMgCJ+ysrGvLbA3jJR2MVzo9Zj7VTJiSHHu22/IFcyKjwBa1+SyiZhULzJIFPCS7ESs8Lp/TYHGKvEQP1SW2A9qu2xh4JjZ0OXYpgFd9hX+BNDBeNgp+d4kwkouUfJaTKUSCjwAVURGcKAwzoaOlDqdgqpiHqKI2AAGDpLAoFLK3q7uuY7hBhrq8wbZjAksHNhRdJLNzyjnMMM7A0svNz6nJAIPTQdUpCdzRKBbhLeMo5djo6mbsDu5r4CRjEzMXxA4F5oP0seBn4987BxYEliAIw6C9fCVgKCTBMMUvFsgk7ut3sUTGFBMBVCw24yOKiSEBAAA7" />
</div>
<!-- PLAYER WILL BE INSERTED HERE -->
</div>
<script type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
<script type="text/javascript">
if (typeof console == "undefined") {window.console = {log: function () {}};}

/* A proof of concept of having a banner displayed over the player until a live event starts.
Not tested for all possible situations nor supported by Brightcove
*/
var player,experienceModule,videoPlayer,
errorTime=0,
placeholderElem = document.getElementById("placeholder"),
overlayElem = document.getElementById("overlay"),
progressElem = document.getElementById("progress"),
messageElem = document.getElementById("message"),
retryTime = 10000;

// All "param" elements that will go into the player object
var playerConfig = {
"width": "480",
"height": "270",
"playerID": "1234567890",
"playerKey": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"isVid": "true",
"isUI": "true",
"autoStart": "true",
"wmode": "transparent",
"@videoPlayer": "987654321",
"templateErrorHandler": "onTemplateError",
"includeAPI": "true",
"templateLoadHandler": "onTemplateLoaded",
"templateReadyHandler": "onTemplateReady"
};

function onTemplateLoaded(id) {
console.log("LOADED");
// Show the loading bar to give viewer feedback that we are checking if the stream is available
progressElem.style.visibility = "visible";
player = brightcove.api.getExperience(id);
videoPlayer = player.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
// Event listener so we know if the stream is successful
videoPlayer.addEventListener(brightcove.api.events.MediaEvent.BEGIN, onBegin);
}

function onTemplateReady(event) {
console.log("READY");
// We're not doing anything on ready, but we could be
}

function onTemplateError(event) {
// An error has occurred. This is either the stream not yet ready or a transient error.
console.log("ERROR");
console.log("Old: " + errorTime);
console.log("New: " + Date.now());
// If an error is fired very soon afterwards, ignore it
if (Date.now() - errorTime > 500) {
// In ten seconds, try again
console.log("ADD TIMEOUT FOR READDING PLAYER");
//window.setTimeout(addPlayer, 2000, playerConfig, placeholderElem); // Grrr IE doesn't send the parameters
window.setTimeout(function() {addPlayer(playerConfig, placeholderElem)}, retryTime);
// Remove the player.
console.log("REQUEST REMOVE");
window.setTimeout(removePlayer, 2); // Delay is for IE
// Remove the progress bar
console.log("HIDE SPINNER");
progressElem.style.visibility = "hidden";
} else {
console.log ("DOUBLE EVENT IGNORED");
}
errorTime = Date.now();
}

function onBegin(e) {
console.log("BEGIN");
// Playback has begun, remove the overlay
overlayElem.style.display = "none";
// If we get an error once playback starts (like an CDN server problem), we'd want to try reconnecting more quickly
retryTime = 1000;
// And the message shown will be different
messageElem.innerHTML = "Please wait";
// Set event handler for complete - when the stream is finished
videoPlayer.addEventListener(brightcove.api.events.MediaEvent.COMPLETE, onComplete);
}

function onComplete(e) {
console.log("COMPLETE");
// Playback has finished, show the overlay with a new message
progressElem.style.visibility = "hidden";
overlayElem.style.display = "block";
messageElem.innerHTML = "Thank you for watching";
}

function addPlayer(config,elem) {
console.log("ADD");
// Create an object element with the above player parameters
var playerObj = document.createElement("object");
playerObj.id = "myExperience";
playerObj.className = "BrightcoveExperience";
console.log(playerObj);
for (var param in config) {
var playerParam = document.createElement("param");
playerParam.setAttribute("name",param);
playerParam.setAttribute("value",config[param]);
console.log("ADD-APPEND PARAM TO OBJECT");
playerObj.appendChild(playerParam);
}
//console.log(JSON.stringify(playerObj));
// Create a new player appended to the "elem" element
console.log("ADD-CREATE EXPERIENCE");
brightcove.createExperience(playerObj,elem,true)
}

function removePlayer() {
// Remove the player
brightcove.removeExperience("myExperience");
}

// Add the player for the first time
addPlayer(playerConfig,placeholderElem);
</script>

</body>
</html>

You can see the example running here.

Removing the Video Title from a Chromeless Video Player

$
0
0
0

All Chromeless Video Players display the video title in the upper left corner of the player. In this topic, you will learn how you can publish players that do not display the video title in the player.

Removing the video title from Chromeless Video Players

We get a lot of questions on how to remove the title. Unfortunately, there is no way in Video Cloud Studio to indicate that you want the title removed. The only way to remove the title is by using the Smart Player API.

Note: The Smart Player API is available to all Video Cloud publishers.

Using the updateMedia() method that is available as part of the Smart Player API, you can programmatically change the properties of the video and set the title to the empty string.

For a complete code example, see the Smart Player API Sample: Update Media example available out on the Brightcove Developer Documentation website.

Chromeless controls interfere with ad interactivity

$
0
0
SFDC ID: 
501a0000000fAC0AAM
Weight: 
0

Issue

By default, Chromeless Player controls display at the bottom of the player on mouseover. It's possible that the same space occupied by controls would also be occupied by ad interactivity, such as a Skip Ad button. In this case, the controls retain functionality, but overlaid ad elements may not. 

Some native devices (iPhone, for example) do not offer a way to manage display of the controls, but various methods of customizing the behavior exist via custom development wherever this actually is an option (generally, Flash-based environments). 

Note:
 If you do elect to hide the controls during ad playback, the experience of having no control at all during ad playback can be undesirable for viewers who may wish to pause ads or adjust volume. In this case, you may prefer to consider alternatives such as smaller custom controls, or displaying some control during ad mode.

Solutions

Custom BEML Template: Custom Layout (Pro edition or higher)

By creating a custom set of controls using BEML, you might resize the controls or move them to another area (such as the top), to minimize the impact of their presence. This may be less attractive since there's still the option of their interfering, but still allows for user control over the experience. 

You can experiment with custom controls using the article as a reference:

http://support.brightcove.com/en/video-cloud/docs/code-sample-creating-custom-chromeless-video-player

Custom BEML Template: Hide controls during ad (Pro edition or higher)

Visibility of a player element can be controlled using the "visible" parameter. This can be bound dynamically to the state of the "Sponsor Message". By creating custom controls and binding to this value, you can effectively hide the controls when an ad is playing.

Create custom controls following the same article as a guide:

http://support.brightcove.com/en/video-cloud/docs/code-sample-creating-custom-chromeless-video-player

…and bind to "visible". Below is one way you might achieve this:

<ChromelessControls boxType="hbox" visible="{!videoPlayer.menu.open}" vAlign="bottom">
        <HBox visible="{!adContext.sponsorMessageVisible}" vAlign="bottom">
          <!-- include all your custom controls here within this HBox -->
          </HBox>

Player API: Hide controls during an ad (any edition) 

Display or visibility of controls can be controlled at runtime using the Flash-only Player API. This does not require a custom BEML template, but does require some basic familiarity with working with the API, and the player must be enabled for API interaction.

See a live example

Note: If using the Smart API for other interactivity, it may be preferable to include this functionality within a SWF Plugin to prevent conflicts between the Flash-only and Smart APIs. See the Actionscript section below.

Javascript

Below is a snippet of code that would effectively hide the controls whenever an ad is actively playing.

var _player, _videoPlayerModule, _adModule, _experienceModule, _chromelessPlayer, _chromelessControls;
function onTemplateLoaded(player){
	console.log("templateLoaded");

	_player = bcPlayer.getPlayer(player);
	_adModule = _player.getModule(APIModules.ADVERTISING);
	_experienceModule = _player.getModule(APIModules.EXPERIENCE)
	_experienceModule.addEventListener(BCExperienceEvent.TEMPLATE_READY, onTemplateReady)
}

function onTemplateReady(evt){
	console.log(evt.type);
	//get a reference to the player interface
	_chromelessPlayer = _experienceModule.getElementByID("videoPlayer");
	//get a reference to the controls
	_chromelessControls = _chromelessPlayer.getControls();

	_adModule.addEventListener(BCAdvertisingEvent.AD_START, onAdPlay);
	_adModule.addEventListener(BCAdvertisingEvent.AD_RESUME, onAdPlay);
	_adModule.addEventListener(BCAdvertisingEvent.AD_PAUSE, onAdStop);
	_adModule.addEventListener(BCAdvertisingEvent.AD_COMPLETE, onAdStop);
}

function onAdPlay(evt){
	_chromelessControls.setVisible(false);
}

function onAdStop(evt){
	_chromelessControls.setVisible(true);
}
Actionscript

A third-party developer has created an Actionscript plugin, which we have linked to from our Open Source site, "Hide Chromeless Controls for VPAID Ads".

Opensource code is not officially supported by Brightcove, however, the above plugin may be a solution or guide for you or your Actionscript developer(s). This essentially performs a similar function as the Javascript code above.

Modified date Salesforce: 
Thursday, August 8, 2013 - 10:13

SEO Best Practices

$
0
0
0

This topic describes how to optimize the URL for you video content page and covers the following solutions:

  • Choose between a subdomain and a folder
  • Optimize your video URL for SEO
  • Index your site content
  • Add context to HTML content using microformats

Choosing between a subdomain and a folder

When choosing a video URL that uses a subdomain (video.domain.com) or uses a folder structure (domain.com/videos), there are a few things to consider:

  • Use domain metadata
  • Add cross-linking between domains
  • Include text content on your video page

Using domain metadata

Search engines typically view each distinct domain as its own "site" and use the total content of a site to grade that site's legitimacy and worth.

If video.domain.com has a lot of really good content, but lacking in metadata, it's going to be poorly received by search engines. In the case where the metadata is lacking, the video portal will benefit from being on the same domain as the main site, because it would get a boost from the content found there. In this case, it is best to use the existing domain and use the domain.com/videos approach.

Adding cross-linking between domains

If the video portal has good standalone content with metadata, then it will likely get the biggest boost from inlinking. This is especially true for a lot of linking.

Search engines look at how many distinct sites are linking into another site as part of their evaluation. If domain.com already has a lot of traffic, and a high search engine ranking, then it's going to be very influential in its linking to video.domain.com. As long as the video site's content can stand on its own, this is the ideal setup. It goes both ways, so links from the video site back to the main site will increase its ranking a bit as well. In this case, it is best to put your video portal on a distinct server and use the video.domain.com approach.

Including text content on your video page

In addition to metadata, include video names, descriptions, transcripts, hierarchy, etc in the page to ensure that search engines have enough context.

The ideal situation, if you have the freedom to implement it, is to use the subdomain approach (video.domain.com) and make sure the portal has a lot of good metadata to overcome the new site ranking deficiency.

Optimizing your video URL for SEO

The URL is often overlooked when optimizing a web page for SEO, but it can be an important part of solution. Here are a few things to consider:

  • Use keywords in the URL
  • Use hyphens instead of underscores
  • Avoid duplicate and extra words

Using keywords in the URL

While it is not required to use keywords in the URL, it does help search engines.

If you name folders and pages in the URL with keywords that appear in the content of the page, then search engine crawlers can easily index the pages and return the appropriate page.

Use descriptive words in the URL that describe the contents of the page. Use as few words as possible. With fewer words, each word will receive more value from a search engine spider.

Put the most important words at the beginning of the URL. Words toward the end of a longer URL do not get much significance. One way to accomplish this is to use shorter section names, allowing the page name to be closer to the root domain.

Avoid using parameters, such as ?, &, or % in URLs.

Do not stuff keywords in a URL.

Do not use capital letters in URLs. In general, URLs are case-sensitive. So, using mixed case URLs can be a source of duplicate content. The easiest way to avoid this is to write all URLs in lower-case. This will also simplify any case-sensitive SEO or analytics reports.

Using hyphens instead of underscores

It is recommended to use hyphens in your URL structure or no word separators at all. Underscores are not SEO-friendly and Google does not consider them to be word separators.

If you are already using underscores in your URL, it is better to leave them since they have already been indexed by search engines.

Avoiding duplicate and extra words

It is best to remove extra words in your URL unless they are a part of the keyword. You can keep the URL short by not using unnecessary words like "a", "our", "for", "and", "the", etc.

Do not repeat words in a URL. For example, do not use the same word for the section and page name in a URL. You also don't want to use duplicate page names even if they are located in different sections of your site. This can cause duplicate content problems for search engines.

Your web page URL describes your content to visitors and search engines. Keeping them short and descriptive makes it easy for search engines and users to understand what will be found. The URL should contain keywords that are consistent with the content on the website. Cleaning up your URLs not only helps with SEO, but also helps with usability for the visitors to your site.

Indexing your site content

With more internet content being multimedia, you need to make sure that search engines can index your content. There are two ways to accomplish this:

  • Create a sitemap
  • Create a video sitemap

A simple MRSS feed may also work if you don't have the means to produce a video sitemap.

Creating a sitemap

A sitemap is an XML file that tells search engines about the pages on your website. This file lists URLs for each page along with additional metadata, such as when the page was last updated, how often it usually changes and how important it is relative to other URLs on your site.

Because the sitemap lists pages (URLs), you will want to create a page (URL) for each video in your library. You can do this with a single web page where the content and metadata is set dynamically from the server-side of your application. Use the Video Cloud Media APIs to fetch metadata about your video and write it to the web page. This will allow search engines to find every video in your collection and index the metadata for each file.

For details about the XML structure, refer to the sitemaps XML format site.

Creating a video sitemap

A video sitemap lets media-centric search engines, like video.google.com, to index your content. The video sitemap is an XML file that uses the same schema as the standard sitemap, with the addition of some video specific metadata tags.

The code needed to create a video sitemap is similar to that for creating a standard sitemap, except you are adding additional metadata for each video entry.

For details about the XML structure, refer to the Google Webmaster Tools site

For details about how to create a standard sitemap and a video sitemap for your video pages, see the Make Your Video Content Indexable document.

Note: Dynamically generating a sitemap requires using the Brightcove Media API to fetch metadata. This is available to Express 3, Professional and Enterprise accounts. Users with Express 1 and 2 accounts can create a static sitemap by gathering the data from Video Cloud Studio and browser developer tools.

Add context to HTML content using microformats

While HTML tags tell the browser how to display your content, it doesn't provide any information about what the content means. Your site may be generated from structured data, probably stored in databases, but the structure is lost when it is formatted in HTML. Search engines can benefit from knowing about the structure of the data on your site.

A collection of schemas (i.e. HTML tags) has been created to identify the type of content on your web pages. Search engines including Bing, Google, Yahoo and Yandex rely on this markup to improve search results.

These schemas, or microformats, provide you with a collection of shared vocabularies to add to your markup that will define the content on your web page. You can find details about these tags at schema.org.

For your media player, Brightcove recommends using the VideoObject schema.

Brightcove has created a tool to generate your player publishing code with the microformat data included. Check out the Video Cloud Schema Builder.

Note: The schema builder tool requires access to the Brightcove Media API. This is available to Express 3, Professional or Enterprise accounts. Users with Express 1 and 2 accounts can add the schema data manually after gathering the needed information from Video Cloud Studio and browser developer tools.

Loading Video Cloud players via Actionscript in HTTPS / SSL environments

$
0
0
SFDC ID: 
501a0000000fAyTAAU
Weight: 
0

Issue

Brightcove supports Video Cloud players published in Actionscript using the default publishing code from the Studio.

However, Players published using the default Actionscript publishing code will not load if Flash applications are loaded in an HTTPS web environment.

Solution

Modify the code as noted in order to allow functionality:


1) In BrightcovePlayer.as, allow the domain. Line 50 (or so), contains the below value:

Security.allowDomain("http://admin.brightcove.com");

Add a second value, so both these domains are listed and allowed:

Security.allowDomain("http://admin.brightcove.com");
Security.allowDomain("https://sadmin.brightcove.com");

2) Add secureConnections=true. This can be added in one of two ways:


a) To the config Object, when instantiating the player:

var config:Object = {};
config.playerID = {yourPlayerID};
config.playerKey = "{yourPlayerKey}";
config.width = 480;
config.height = 270;
config.secureConnections="true";
var player:BrightcovePlayer = new BrightcovePlayer(config);

or,


b) in BrightcovePlayer.as:


Line 111 (or so) contains the following code:

var file:String = cacheServerServices + "/viewer/federated_f9?" +
"&playerWidth="+escape(config["width"])+
"&playerHeight="+escape(config["height"])+
"&dynamicStreaming=true"+
configItems;


add the configuration parameter to allow for secure connections, as below:

var file:String = cacheServerServices + "/viewer/federated_f9?" +
"&playerWidth="+escape(config["width"])+
"&playerHeight="+escape(config["height"])+
"&dynamicStreaming=true&secureConnections=true"+
configItems;


This will cause the player shell to load from our HTTPS server, and should function for you.


Note: If you want your project to work well over both HTTP and HTTPS, you could pass this value in flashvars dynamically from the embed code. In that case you might retrieve it yourself from the Stage object for use in the config object.

Modified date Salesforce: 
Tuesday, August 20, 2013 - 11:49

Capturing "begin" and "complete" events if the video is replayed

$
0
0
SFDC ID: 
501a0000000fBElAAM
Weight: 
0

The player API's BEGIN and COMPLETE events fire only only per video load. If the viewer replays the video, those events will not be triggered a second time. This is intentional as this is the behavior expected by many existing analytics plugins that depend on the API.

If you do want to know when a video is played from the beginning or stops at the end a second time, you can use the PLAY and STOP events. The event handler functions are passed an object which includes the current media duration.

Below are example PLAY and STOP event handler functions which distinguish a playback starting at the beginning and and playback stopping at the end of the video.

function onPlay(e) {
  // Event handler for BCMedia.PLAY
if (e.position == 0) {
    // Playing from beginning
    console.log("PLAY_FROM_BEGINNING");
  } else {
    // A play at some other point, e.g. resume from pause
    console.log("PLAY");
  }
}

function onStop(e) {
  // Event handler for BCMedia.STOP
if (e.position > ((e.media.length/1000)-0.1)) {
    // Stopped at end (allow some variance as HTML and Flash players
// report duration to a different granularity)
    console.log("STOP_AT_END");
  } else {
    // A stop at some other point, e.g. paused 
    console.log("STOP");
  }
}

Example

View a Live Example of this code above.

Modified date Salesforce: 
Wednesday, August 21, 2013 - 16:27

Troubleshooting sharing players to Facebook

$
0
0
SFDC ID: 
501a0000000fBM6AAM
Weight: 
0

These are common issues you might encounter when getting videos shared to Facebook to display correctly on Facebook's timeline


Sharing options do not display in the player

The in-player sharing options will not be displayed if the setting to disable the Brightcove Menu is checked, as the sharing functionality is part of the menu. If the player is a custom template, ensure that it does have a share button.


Player is not shown on Facebook

When a link is shared Facebook looks for Open Graph metadata on the page at that URL. It will only show a player if that metadata intructs it to do so. If your page URLs are being shared and you want a player to be shown you'll need to add Open Graph metadata to your pages. See this document for more information: https://support.brightcove.com/en/video-cloud/docs/setting-videos-not-hosted-brightcove-play-within-facebook

You can use Facebook's Open Graph debug tool to see how they interpret your pages. Using this also clears their cache of your page: http://developers.facebook.com/tools/debug


Player is cropped

Facebook may resize the player when they embed it on the site. A player using a custom template with fixed size elements may appear cropped. If creating a custom template for your viral player make sure that it displays as you'd want at various sizes. A standard chromeless player is a simple and good option to use as the viral player.


Player images do not load

If your player template uses external images you'll need to use HTTPS paths to those assets. Most Facebook users access Facebook over HTTPS and the browser will not retrieve the images if served over HTTP.


Advertising does not work

Facebook embeds players in a way that prevents Flash from using certain script functionality for security reasons, notably ExternalInterface.call(). Some third party ad swfs use this (for benign reasons such as determining the page on which the player is embedded) but haven't been coded in a way to allow for the case that their scripts are disallowed. If ads do not display on Facebook contact your ad provider.

Modified date Salesforce: 
Thursday, August 22, 2013 - 10:18

Displaying a Pre-Roll Ad in a Player

$
0
0
Short Description: 
Learn how to display a pre-roll Ad in a player
Video ID: 
2649851784001
Thumbnail URL: 
http://brightcove01.brightcove.com/23/20318290001/201309/113/20318290001_2649854035001_Displaying-a-Pre-Roll-Ad-in-a-Player.jpg?pubId=20318290001
Still Image URL: 
http://brightcove01.brightcove.com/23/20318290001/201309/1721/20318290001_2649842356001_Displaying-a-Pre-Roll-Ad-in-a-Player.jpg?pubId=20318290001
Duration: 
5:27
Modified Date (Studio): 
1378480716676
Published Date (Studio): 
1378326351520

Quick Start: Displaying a Pre-Roll Ad in a Player

$
0
0
0

The purpose of this Quick Start is to show you how to create and configure a player to display pre-roll ads. To learn more about the Advertising module, see Using the Video Cloud Advertising Module. To learn more about delivering ads with HTML5 players, see Delivering Advertising with HTML5.

 

Advertising support is available only for Video Cloud Pro, Enterprise and Express Plan III publishers. Express II publishers have access to DFP Small Business ads only.

After completing this Quick Start, you should be able to:

  • Enable your account for HTML5 advertising
  • Create a player and configure the ad policy for a player
  • Set the ad policy for a video

This Quick Start will show you how to create a new player and configure it to display a DFP IMA 3 ad. Note that other ad servers can also be used with Video Cloud.

Audience

Video Cloud publishers who want to learn how to ad pre-roll ads to a Video Cloud player.

Prerequisites

A Video Cloud account with advertising support.

About the sample ad

This Quick Start uses a DFP IMA 3 ad source and a sample video ad tag URL provided by Google for testing. The process to create an ad tag URL is outside the scope of this Quick Start. To view the pre-roll ad, click here. Note that this sample ad is approximately 50 seconds long.

Displaying a pre-roll ad in a Video Cloud player

To display a pre-roll ad in a Video Cloud player, you will complete the following tasks:

Enable your account for HTML5 ads

HTML5 Ads are available to all advertising-enabled accounts but are not turned on by default. If you want ads to appear in HTML players, you need to enable this account setting.

  1. In a browser window, navigate to videocloud.brightcove.com.
  2. Enter your Video Cloud login credentials and click Sign In.
  3. Click the Account Settings link.
  4. Locate the HTML5 Advertising section and click the Edit link.
  5. Select the Enable option and then click Save Changes.

Create a new player

  1. Open the Publishing module.
  2. Create a new player using the following values:
    • Name:Pre-Roll Ad Player
    • Template:Chromeless Video Player
  3. Click the Create Player button.
  4. To ensure that the player appears in the Advertising module, refresh the page.

Set the ad policy for the player

  1. Open the Advertising module.
  2. Locate the Pre-Roll Ad Player and double-click on it to edit the properties.

    Note: If the Pre-Roll Ad Player doesn't appear in the list, refresh the browser page.

  3. Set the following ad policy for the player.
    • Request ads from this Player: Yes
    • Ad Source: DFP IMA 3
    • Override default Base Ad Tag URL: Yes
    • Base Ad Tag:
      http://pubads.g.doubleclick.net/gampad/ads?sz=400x300&iu=%2F6062%2Fiab_vast_samples&ciu_szs=300x250%2C728x90&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&correlator=[timestamp]&cust_params=iab_vast_samples%3Dlinear
    • Pre-Roll Ad Insertion: Yes
  4. Click Save Changes.

Set the ad policy for the video

  1. Open the Media module.
  2. Select a video in your account you would like to use for this Quick Start and double-click on it to edit the properties.
  3. Go to the Advanced tab.
  4. Check to ensure the Advertising option is enabled and then click Save Changes.

Test the pre-roll ad

With the video you just set the ad policy for, use the Quick Video Publish feature to test the ad.

  1. With the video you just selected to set the ad policy on, click the Quick Video Publish dropdown.
  2. Select the Pre-Roll Ad Player and then click URL.
  3. Copy the URL, open a new browser window and paste in the URL. The Google pre-roll ad should play followed by your video. The ad is approximately 50 seconds long. You should also test the URL on an iOS device to confirm that the ad plays inside of an HTML player.

Displaying multiple videos on a single page

$
0
0
SFDC ID: 
501a0000000fArrAAE
Weight: 
0
You may wish to have multiple videos playable on a single page. There are a few ways you can go about this.

Use a playlist player
The simplest option is to create a playlist and use it in a playlist player. You can publish this player as normal without having to use the player API.

Use a single player, and load content into the player
You may want to create something that looks much like the playlist player, but with the playlist element written into the page's HTML. This would have the advantage that the playlist text would be readable by search engines and could be indexed by them. 

Or, you may have an article containing several different video thumbnails, where a viewer might click to load each into a single player overlay on your page.

Below are a few examples similar to the above use cases:
Use multiple players on the page
You should carefully consider whether this really suits your needs. It's usually a better user experience to have one player on the page with thumbnails that load content into the player when clicked. You should also consider that multiple players will consume more browser resources so the page will take longer to load.

When embedding multiple players on a single page, you must ensure the object id for each is unique. 

Examples:

<object id="myExperience1234" class="BrightcoveExperience">

<object id="myExperience12345" class="BrightcoveExperience">

Generally, the actual string you use is not important (unless you have custom code that has some expectation of a given string), but browsers will reference each player by this ID, they should be different for each player.

When using multiple players is appropriate, you will also want to ensure that other players stop playback when one starts. This example shows how to do that using the player API http://solutions.brightcove.com/cs/smart-player-api/multiple-players.html.

Considerations when using the player API with multiple players
If you use the player API with multiple players on the page you will need to change the syntax used to add event listeners. If you do not you may find that the last player to load may be the only one to work with your code.

Usually you would add an event handler by like this:

videoPlayer.addEventListener(brightcove.api.events.MediaEvent.PLAY, onEvent);

Instead you should wrap the event handler in an anonymous function, like this:

videoPlayer.addEventListener(brightcove.api.events.MediaEvent.PLAY, function(event) {
  onEvent(event);
});

You may find it useful to pass in a reference to the player or one or more of its modules, like this:

function onTemplateLoaded(id) {
  var player = brightcove.api.getExperience(id);
  var vp = player.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
  vp.addEventListener(brightcove.api.events.MediaEvent.PLAY, function(event) {
    onEvent(event, vp);
  });
}
function onEvent(event, videoPlayer) {
  videoPlayer.getCurrentRendition( function(rendition) {
    console.log(rendition);
  });
}

For an example of adding event listeners in this way see this example: http://solutions.brightcove.com/cs/smart-player-api/multiple-players.html
Modified date Salesforce: 
Monday, September 9, 2013 - 12:07

Checking when FTP Batch Upload is Complete

$
0
0
-81

When you are using FTP batch provisioning to upload videos to Video Cloud, you may want to be notified when the upload is complete. You can get notification by email, or you can use the callback feature, which sends upload notifications to the URL you specify.

FTP batch provisioning follows this process:

Pay special attention to the notes in the diagram. Often troublesome are the points that the media uploads must complete before the XML is uploaded, and the callback does NOT mean all renditions are transcoded, just that the process has started.

Using the callback feature

To use the callback feature, include a <callback> element in the manifest file for your FTP batch upload. The <callback> element is a child of the top-level publisher-upload-manifest element. It has a single attribute, entity-url, whose value is the URL you want the upload status posted to.

Example

<callback entity-url="http://example.com/batch-callback.php"/>

You will receive notification only of failures, not successes, unless you have set the attribute report-success="true" in the publisher-upload-manifest tag of your manifest.

Note that HTTP callback endpoints must return HTTP 200 if the request was ok. Other "success" codes such as HTTP 202 are not supported by our callback system.

HTTP Callbacks

Each time a tag is executed in a manifest, the Video Cloud system initiates a POST request, just like when you submit a form, and sends it to the URL you specified in the manifest. The following key/values (form data) are sent in the request:

KeyValue
referenceIdthe reference id provided in the manifest
idthe id of the video, playlist, or asset in the database
entityVIDEO, LINEUP (playlist), or ASSET
actionCREATE, DELETE, or UPDATE
statusFAILED or SUCCESS
errorAn error message

Handling the POST Request

When the data arrives, you need to do something with these values. Any server side language will likely be able to function as a listener for these requests.

The most common actions to take would be to append these values to a log file, insert these values as a row in a database, or send an email that contains the same information. In this example, we'll use a PHP script to listen for these values and then write them to a log file. You can download a zip file that includes the PHP script.

Here is a snippet from the code to show you exactly what is happening

<?php

// Begin by checking to see if "referenceId" is included in the POST request.
// If it is, assign its value to the $referenceId Variable.
// If it is not, assign the value of null to $referenceId.

if(isset($_POST["referenceId"])) {
    $referenceId = $_POST["referenceId"];
} else {
    $referenceId = null;
}

/* Repeat the same code for each key in the request */

// Next build a string that constrains the current date and time as well as
// the value for each key that was included in the request separated by
// a comma so that it can easily be imported as a CSV file.
//
$logEntry = date("m-d-y H:i:s") . ": " .
            $referenceId . "," .
            $id . "," .
            $entity . "," .
            $action . "," .
            $status . "," .
            $error .
            "\n";

// Lastly, tell PHP where it can find the log file and tell PHP to open it
// and add the string we created earlier to it.

$logFileLocation = "log.txt";
$fileHandle = fopen($logFileLocation, 'a') or die("-1");
fwrite($fileHandle, $logEntry);
fclose($fileHandle);

?>

This will result in a log file that looks like this:

06-04-11 17:42:34: 123456789ref,123456789,VIDEO,CREATE,FAILED, (continued)
This failed because it was just a test
06-04-11 17:42:35: 123456790ref,123456790,VIDEO,CREATE,FAILED, (continued)
This failed because it was just a test
06-04-11 17:42:36: 123456791ref,123456791,VIDEO,CREATE,FAILED, (continued)
This failed because it was just a test
06-04-11 17:42:37: 123456792ref,123456792,VIDEO,UPDATE,SUCCESS,
06-04-11 17:42:40: 123456793ref,123456793,VIDEO,UPDATE,SUCCESS,
06-04-11 17:42:41: 123456794ref,123456794,VIDEO,DELETE,SUCCESS,
06-04-11 17:42:42: 123456795ref,123456795,VIDEO,DELETE,SUCCESS,

 

Viewing all 2356 articles
Browse latest View live