1

Is there any way to force a Kaltura videoplayer to stop ONLY using code and the Kaltura API?

Currently I have solved it by adding a Access Control Profile named "Free preview" under Settings > Access Control in KMC and then added this profile to the Entries I've choosen. I then add the session to the players flashvars to restrict non-members to only watch the preview, not the whole clip.

But I would like to restrict ALL, or even better selected Categories of clips by using only code, so I don't need to involve KMC.

Is that possible?

Alt) Can you create a new player in KMC and restrict it to viewing only X seconds, no matter what length of Entry? Then I can do the check if user is valid or not and get the category via API and show it in the "preview-player" och the "default player". If I use the mediaProxy.mediaPlayTo attribute the clip stops, but is easily started again by presing play.

Would greatly appreciate an answer

fredrik_w
  • 51
  • 3

2 Answers2

1

I got this answer from a guy named oferc in a different forum:

You can listen to the head move event and pause the clip it goes beyond a certain time (then if someone pressed play, you can stop it again)

function jsCallbackReady(player_id) {
  my_kdp = $("#"+player_id).get(0); // document.getElementById(player_id) if you do not use jquery/ prefer pure js
  my_kdp.addJsListener("kdpReady", "kdpReady"); // when you load the player with an entry (and the player is ready to begin playing it using doPlay for instance)
}

function kdpReady() {
  my_kdp.addJsListener("playerUpdatePlayhead","headMove");
}

function headMove(position) {
  if (position > "30") { // Your Time, example 30 seconds
    my_kdp.sendNotification('doStop')
  }
}

Works like a charm!

fredrik_w
  • 51
  • 3
0

fredrik_w - neither of the ways you chosen here are a good option to restrict access. in both cases, your videos are made public, and can be easily accessible by anyone.

The best way to limit access to a video is by defining an Access Control, and like everything in Kaltura, you can define an ACL using API as well.

Check this out as a reference sample- http://blog.kaltura.org/turning-profit-online-video-made-easy-using-paypal-html5-digital-goods

Zohar.Babin
  • 265
  • 1
  • 2
  • 8
  • Thanks! I have already figured that out myself, and right now I´m working on a different solution. – fredrik_w Sep 12 '12 at 07:11
  • This system is a little special(aren´t they all) and the streaming media is not supposed to cost anything but limited to members only, providing a short preview for non members and when the video is shared. For that the only way is using the build-in Access Control like you said. – fredrik_w Sep 12 '12 at 07:14