Subscribe to Our Newsletter

x

Integrating JW Player on RebelMouse

JW Player is a popular video CMS that provides transcoding, encoding, and a sophisticated player that can be connected to DoubleClick for Publishers (DFP) and other ad-targeting systems. RebelMouse has a deep integration with the platform for our clients that have their own JW Player license.


The integration allows editors to upload from our creation tool directly into JW Player, as well as the ability to choose different players that you've already configured according to context and workflow.

In addition, we have a search interface in our content creation tool that allows you to easily search across your own library and build articles based on your video library.

You're able to upload your videos easily from Entry Editor:

You can also edit the descriptions of your videos:

Browse your video library to select which video you want to embed in your article:

We support JW Player in lead media spots, and we support this for Google Accelerated Mobile Pages (AMP) as well. You can embed JW Player in a post's body and/or create slideshows, listicles, or amazing playlists.

Types of Integration

  • Lead media
  • Particle media
  • Media in the body of a post
  • Playlists
  • Home pages
  • Section pages
  • Tag pages

Lead Media Integration

There are two ways to integrate JW Player into your lead media. In both cases, it requires a custom JavaScript code to activate the player.

The first option is to use our post thumbnail instead of loading JW Player. This is the best option for page speed because we render an image that loads the embed on click, avoiding the payloads of a full embed. Keep in mind that for this scenario, the player itself should have autoplay turned on. This way, when we replace the thumbnail with a player, it will start playing right away.

It's important to note that if a user updates a video thumbnail in their JW Player dashboard, they will also need to update it in our Entry Editor before it will be shown on site — we cache these for speed.

The second way is to load a video embed. In this scenario, the player shouldn't have autoplay enabled. The compromise here is that RebelMouse will need to rely on JW Player to render a proper thumbnail ratio, especially for smaller teasers. There could also be some slowdowns if you have 10+ video teasers located on one page.

Particle Media

For videos located in our Particle Assembler, we load all of the needed initializations from the server's side, which means the player will be initialized right away.

Playlists

This is a special type of rendering using our Particles feature. It uses our thumbnails, and it requires a hard-coded site section in a RebelMouse Runner template to render it. It also requires additional custom JavaScript to make the playlist logic functional. We are currently working on turning this into a simple element you can style, but contact us to set up a playlist layout for you. Editorially, you choose the Playlists layout to enable this.

Custom JavaScript Code

Here are some useful JW Player code samples you can plug into our Layout & Design tool:

Assembler code for JW Player should look like this.

Here's an example for handling the play button through custom JavaScript:

function VideoPlayerLoader() {

if (widgetsHead.length) {
    widgetsHead.forEach(function(widgetHead) {
        let video = widgetHead.querySelector('.widget__video');
        let image = widgetHead.querySelector('.widget__image');

        if (video) {
            const regex = /players\%2F([\w\-])+\.js/g;
            const script = video.querySelector('script[type="video-content"]');
            let str = '';

            if (script) {
            str = script.innerText;
            }
            console.log('not null === ', str);
            if(str.length) {
                str = regex.exec(str);

                    if (str !== null) {
                let videoPlayer = str[0].replace(/players\%2F/g, '').replace('.js', '').split('-');
                let videoWrapper = document.createElement('div');
                let videoPlayerScript = document.createElement('script');

                if (location.pathname === '/') {
                    videoPlayer[1] = '{{$YOUR-PLAYER-ID}}';
                }
                videoWrapper.id = 'botr_' + videoPlayer.join('_') + '_div';
                videoPlayerScript.src = 'https://content.jwplatform.com/players/' + videoPlayer.join('-') + '.js'

                image.onclick = function () {
                    image.className += " hidden";
                    video.style.display = "block";
                    video.appendChild(videoWrapper);
                    video.appendChild(videoPlayerScript);
                };
            } else { //copy from ui-basics to cover the rest of videos
                if (script) {
                    image.onclick = function () {
                        video.innerHTML = script.innerHTML;
                        image.className += " hidden";
                        video.style.display = "block";
                        }
                    }
                }
            }
        }
    });
}
}

document.addEventListener("DOMContentLoaded", function (event) {
    VideoPlayerLoader();
});
{{require}}(['jquery', 'core/event_dispatcher'], function ($, eventDispatcher) {
    eventDispatcher.on('load-more:sync', function() {
        VideoPlayerLoader();
});

});

How to Include Interactive Elements in Posts

Enhance your articles with rich and creative media

Every article is a fresh chance to grab new readers and nurture loyal followers. This is why we give creators every opportunity to build content rich with media elements that enhance every reader's experience.

Add More Layers to Your Content

You can easily add interactive elements, like charts, to posts on our platform. For example, if you need to embed iframe code into a post, this can be done via our Add Media Bar. To do so, click the code icon (< >):

A text box will appear so you can insert your code:

Embedded Code Across Platforms

One important thing to keep in mind is that Google AMP, AppleNews, and Facebook Instant Articles will not always support embedded code. So if you use an iframe, it's best to turn off distribution to those channels for that particular post. If you have a lot of posts that require embedded code, this could be problematic for growth across those important platforms.

If you do want to use an iframe on a post destined for Google AMP distribution, it can be possible if the iframe is not at the top of the page or within the first 75% of the viewport when the page is scrolled to the top (whichever is smaller). AMP is a fast technology designed for mobile users and iframes are loaded using arbitrary timing that AMP's technology cannot ensure. For this reason, it's suggested that iframes be included in places that are not visible by users upon load.

If you have an article that needs to include an iframe at the top of the page, or within the first 75% of the viewport, AMP can be turned off for that individual article within Entry Editor.

If you don't need an interactive chart to be interactive in nature, can turn it into an image and upload it directly to your post. This way it will work on all platforms, including Google AMP, Apple News, and Facebook Instant Articles. This option, when possible, is ideal to ensure you're optimized for page speed.

Take Advantage of Shortcodes

Another great way to embed media is through our shortcodes functionality. Click here to learn more about shortcodes. Shortcodes can also inserted using the Add Media Bar. Click the brackets icon ([ ]) to choose the shortcode you want to use.

Here's an example of a chart on an article page that's been inserted using a shortcode:

If you have any questions about how to add interactive elements to your content, please email support@rebelmouse.com or talk to your account manager today.

Shortcodes Dashboard: Dynamic Media in Just a Few Clicks

Create multidimensional content with easy-to-find shortcodes

We believe static media is dead, and that every piece of content should be multidimensional and engaging. This is why our platform enables creators so they can add dynamic media to their content in easy and efficient ways.

One simple way to add interactive content to any post is through the use of shortcodes. Shortcodes are small snippets of code that are easier to remember than longer sequences. They typically will activate a feature or embed media into an article.

Keep reading... Show less
Subscribe to Our Newsletter