Content Management

Uploader widget

Uploader widget example

You can easily integrate our uploader widget into your application to provide an easy way for your users to upload their video content into the TargetVideo platform.

<script src="https://player.target-video.com/js/api.min.js"></script>

<div id="bridApiUploader"></div>

<script>
    // Initialize the uploader widget
    $BridApi.Uploader.init({'access_token' : 'YOUR_API_TOKEN', 'partnerId' :'YOUR_PARTNER_ID'});
    
    // Add the "on" event listener
    $BridApi.Uploader.on('VideoAddForm', function(e){
        // e.detail is the add-video response. It also fires when a save fails, so check status first
        if (e.detail.status) {
            console.log(e.detail.id)           // the new video's ID
            console.log(e.detail.data.Video)   // its details
        }
    });
</script>

The above code will load the uploader widget in your app and will provide an easy way for your users to upload their video content.

The page needs an element with the ID bridApiUploader; the widget loads into it as an iframe. init() requires access_token and partnerId, and also accepts width and height in pixels (default 900 × 500) and border (default 0).

Listen for two events with $BridApi.Uploader.on(): uploaderLoaded fires when the widget has loaded, and VideoAddForm fires each time the user saves a video. e.detail is the response of the add-video API call — status, message, the new video’s id and its data. It fires on failed saves too, so check e.detail.status first.

🛑 Caution

It is highly advised that only your trusted users have access to this widget as your API token will be visible in the page source.

📘 Note

The default upload file size limit is 5GB. If you need to upload larger files, contact support@target-video.com for an increase.

Uploader widget · TargetVideo Developer Docs