7

Assuming I have the video IDs can I access a still of the video?

I have read of the media API and the read functions for thumbnailURL and videoStillURL but have no idea how to implement.

Are there examples of using a still from an asset given the ID?

AusS2000
  • 79
  • 1
  • 2

2 Answers2

0

Yes, most all of the Media API read methods will return the videoStillURL and thumbnailURL if you specify them in the video_fields, or just return all fields. Once you get the URL, you can use it as the src value for an tag or you can browse to the URL if you want to download the image. There are many examples on the Brightcove sites of using these URLS to populate image tags src values -- see http://solutions.brightcove.com/bcls/AnalyticsAPI/most-popular-videos.html for example.

  • Wow, hard to sort the wheat from the chaff. My investigations led me to this URL: http://api.brightcove.com/services/library?command=find_video_by_id&video_id=1520880903001&video_fields=thumbnailURL&media_delivery=http&token=jskS1rEtQHy9exQKoc14IcMq8v5x2gCP6yaB7d0hraRtO__6HUuxMg.. It returns an array of the parameters requested. I modified the video ID and parameters but I'm guessing the token is unique to that request/account. How do I retrieve the correct token? – AusS2000 Jun 20 '13 at 01:56
  • See http://support.brightcove.com/en/video-cloud/docs/managing-media-api-tokens for details on managing tokens. – Mark Jun 20 '13 at 04:09
  • Ahh, tokens aren't available on trial accounts. That could be a problem. – AusS2000 Jun 20 '13 at 07:59
  • Is there a way, within the limits of the trial account, to access the videoStill URL (or any still image of the video)? – AusS2000 Jun 20 '13 at 23:21
  • Support have kindly upgraded my account and I have access to a token and can return a JSON string of the videoStillURL. Cheers – AusS2000 Jun 21 '13 at 01:51
0

Yes, you can get thumbnail image url of a BrightCove video from player instance. Which means when a player is loaded and we get instance object of player (e.g. playerInstance), we can get the thumbnail url from playerInstance.mediainfo.poster.

mediainfo can't be called directly when player is loaded because video information loads after the player is initialized so we need to wait for mediainfo object to have required information. Hence we need to call playerInstance.mediainfo.poster on loadeddata event. Please refer the code example underneath.

// After loading BrightCove script
i.e. https://players.brightcove.net/[ACCOUNT_ID]/[PLAYER_ID]_default/index.min.js

// Initialise player using videojs object
let playerInstance;

videojs.getPlayer('[ID_PROVIDED_IN_BRIGHTCOVEPLAYER_ELEMENT]',).ready(() => {
    playerInstance = this; // Assigning player instance

    playerInstance.on('loadeddata', () => {
        console.log(playerInstance.mediainfo.poster); // Thumbnail URL
    });
});

But if you need thumbnail image before you initialise Brightcove player, there is no exact way to get it from the same API. There is another API provide by brightcove, please refer the same. https://apis.support.brightcove.com/playback/code-samples/thumbnail-grid.html