Contact Support | System Status
Page Contents

    Brightcove Player Sample: Audio-Only

    In this topic, you will learn to create a Brightcove Player that plays your content in audio-only mode. The video still image is displayed during playback, so you will not see the video content, but you will hear the audio track.

    Development sequence

    Here is the recommended development sequence:

    1. Use the In-Page embed player implementation to test the functionality of your player, plugin and CSS (if CSS is needed)
    2. Put the plugin's JavaScript and CSS into separate files for local testing
    3. Deploy the plugin code and CSS to your server once you have worked out any errors
    4. Use Studio to add the plugin and CSS to your player
    5. Replace the In-Page embed player implementation if you determine that the iframe implementation is a better fit (detailed in next section)

    For details about these steps, review the Step-by-Step: Plugin Development guide.

    iframe or In-Page embed

    When developing enhancements for the Brightcove Player you will need to decide if the code is a best fit for the iframe or In-Page embed implementation. The best practice recommendation is to build a plugin for use with an iframe implementation. The advantages of using the iframe player are:

    • No collisions with existing JavaScript and/or CSS
    • Automatically responsive
    • The iframe eases use in social media apps (or whenever the video will need to "travel" into other apps)

    Although integrating the In-Page embed player can be more complex, there are times when you will plan your code around that implementation. To generalize, this approach is best when the containing page needs to communicate to the player. Specifically, here are some examples:

    • Code in the containing page needs to listen for and act on player events
    • The player uses styles from the containing page
    • The iframe will cause app logic to fail, like a redirect from the containing page

    Even if your final implementation does not use the iframe code, you can still use the In-Page embed code with a plugin for your JavaScript and a separate file for your CSS. This encapsulates your logic so that you can easily use it in multiple players.

    Select implementation

    Either an in-page or iframe player will work for this sample. Here, the iframe player is used

    The player

    See the Pen Audio-Only Player by Brightcove Learning Services (@rcrooks1969) on CodePen.

    How it works

    Publishing audio content in this way does not require any modification to your player. Just add an audio file to your Video Cloud library. Your audio content must be in the form of a MP4 video with no video track.

    Create the player

    To create a player and assign a video to it, follow these steps:

    1. In the Players module, create a new player or use an existing one.
    2. In the Media module, select an audio-only item and publish it with this player.Assign audio content to the player and publish it.
    3. Copy either the basic (iframe) or the advanced (In-Page) embed code and paste it into a new HTML file.
    4. Add the JavaScript to change the hover message on the play button from Play Video to Play Audio. For the advanced embed code you would need to create a custom plugin for the JavaScript.

    Page last updated on 14 Jun 2021