Close

Copyright © RebelMouse 2019

Follow Us:

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();
});

});

RebelMouse CEO: Reimagining Diversity “Starts in the Office”

Why women, minorities, and the LGBTQ+ community will restructure workplace norms

Entering a new decade means a new opportunity to change how we approach diversity. In a joint interview alongside Leanne Pittsford of Lesbians Who Tech, RebelMouse founder and CEO Andrea Breanna said that the only way to fight patriarchal dominance is to encourage and nurture more women, minorities, and members of the LGBTQ+ community in the workplace, particularly in tech.

Over half of RebelMouse's employees are women or identify as LGBTQ. Read our full diversity and inclusion report here.

Check out the full video below.

Related Articles

Publishers No Longer Have to Submit Their Site to Google News

Google's Publisher Center creates new opportunities for audience growth

Just before the start of the next decade, Google announced an important change to its Google News offering with the launch of Google Publisher Center. The new interface merges Google News Producer and Google News Publisher into one to streamline the partnership process for publishers.

Overall, the change should make it easier for publishers to manage their Google News settings, including updating themes, directing URLs to section pages, and configuring user permissions. Read the full list of features here.

Keep reading...

How to Find Work-Life Balance as a Remote Employee

Tips from our CEO on making the most of an office-free lifestyle

Working from home is becoming increasingly popular, with an estimated 66% of companies now allowing remote work and 16% operating completely office-free. RebelMouse is one of those fully remote companies, and over the years we've mastered how to stay close to each other despite being spread across more than a dozen countries. We believe working remotely is good for both our personal lives and our productivity. Read more about this here.

Still, working free from the shackles of an office environment doesn't mean every day is a dance party in your pajamas from 9 to 5. Working from home comes with its own set of challenges just like any other job.

Keep reading...
Subscribe to Our Newsletter