E-commerce integration: Part 5 – Selling access to media content

E-commerce integration: Part 5 – Selling access to media content

By | 2016-12-01T16:37:45+00:00 November 11th, 2013|Tips & Tricks|0 Comments
[May 16, 2016 – This post was updated to be accurate for Gallery Server 4.]

This is a series of blog posts covering the e-commerce features of Gallery Server.
Part 1: Add ‘Add to cart’ and ‘View cart’ buttons to your gallery
Part 2: Dealing with the PayPal nested form problem
Part 3: Working with multiple prices and options
Part 4: Using multiple ‘Add to cart’ buttons on a page
Part 5: Selling access to media content

Selling access to media content

So far we’ve looked at setting up an e-commerce gallery to sell physical objects like tee shirts and coffee mugs. In this post we’ll look at configuring a gallery to sell access to media content like video or audio files.

There are a number of ways to do this. Which one is best depends on your business requirements and skills set. We’ll look at two approaches.

Technique #1: Duplicate the library

In this technique we create two sets of media objects—one that allows customers to browse the thumbnails and select items for purchase and another that lets paying customers view their purchases. We’ll keep things simple and create an example where we are selling access to a single video.

  1. Create two albums in the gallery. In each one upload the video you want to sell access to.


  2. Open the album named Video and make it private by clicking ‘Hide this album from anonymous users’ in the Security popup found on the Manage tab of the ribbon toolbar. This hides the album from anonymous users. Only customers who purchased access to the video will be able to access it—more on that later.

  3. Go to the UI Templates page, create a copy of the default media object template, and name it Video Store. Assign it to the album named Video Store and look for this line: {{:MediaItem.Views[MediaItem.ViewIndex].HtmlOutput}}</div> Change it to this: {{:MediaItem.Views[0].HtmlOutput}}</div>. What this does is force the UI to render the thumbnail preview of the video instead of the web-optimized version.

  4. Update the right pane and header templates to include the add to cart button and view cart button as described in this post. Make sure the templates are applied only to the Video Store album. When you are done the Video Store album will have full e-commerce functionality. Users won’t be able to watch the videos, but they will be able to add them to their shopping cart and complete the checkout process.


  5. When a user completes a purchase, PayPal sends you a notification with the details of the purchase. Your job is to give the customer access to the second copy of the video hidden in the album named Video. Create a role that has view permission to this album and configure a user to have access to it. Then give your customer the username and password for this account. When they log in they can now view the video:


Technique #2: Authentication sniffing in template

This technique uses a single set of media assets and controls access to them by checking whether the current user is logged on. Anonymous users see the thumbnail image while logged on users can view and play video and audio files. This technique works well when customers pay a set fee for access to all the media content in the gallery.

  1. Add a ‘Buy Now’ button somewhere in the gallery or in a companion website. The idea is that you will give users access to the media content when they complete the checkout process.

  2. Go to the UI Templates page, make a copy of the media object template, name it Video Store, and look for this text:

    <div class='gsp_moContainer'>
  3. Replace it with this:

    <div class='gsp_moContainer'>
    {{if User.IsAuthenticated}}
  4. When a customer purchases access to the gallery, provide them a logon account with view permission to the gallery. They will be able to view the media assets but anonymous users can see only the thumbnail image.

    • Buttons in the ribbon toolbar may provide access you don’t want users to have. Create a customized version of the header UI template to hide buttons such as the download, share, and view original buttons.
    • Remember that Gallery Server does not offer full Digital Rights Management (DRM) protection. If users have the ability to view a video or audio file, they can also download it. Disabling the download button is only a minor deterrence to a motivated individual.
    • The first technique favors ease of implementation over security. For a more secure solution, upload screenshots of the video files in the Video Store album rather than the actual videos.
    • If the thumbnail images are too small, change their size on the Media Settings page. Be sure to synchronize the gallery with the ‘Overwrite thumbnails’ option selected to force the creation of new thumbnail images.


About the Author:

Founder and Lead Developer of Gallery Server

Leave A Comment