Kaltura player not making correct javascript api calls

25 replies [Last post]
Joined: 12/13/2012
Points: 9

Hello all,
I have been setting up my player on my site, and everything is working great, until I try to use the javascript api with it. Let me first show you the code I have written so far:

<object id="kaltura_player_1_tyan50je" name="kaltura_player_1_tyan50je" type="application/x-shockwave-flash" allowFullScreen="true"
            allowNetworking="all" allowScriptAccess="always" height="560" width="1000"
            data="http://www.kaltura.com/index.php/kwidget/wid/_1104952/uiconf_id/9193302">
            <param name="allowFullScreen" value="true" />
            <param name="allowNetworking" value="all" />
            <param name="allowScriptAccess" value="always" />
            <param name="bgcolor" value="#000000" />
            <param name="wmode" value="opaque"/>
            <param name="flashVars" value="emptyF=onKdpEmpty&readyF=onKdpReady&externalInterfaceDisabled=false&entryId=1_tyan50je" />
            <param name="movie" value="http://www.kaltura.com/index.php/kwidget/wid/_1104952/uiconf_id/9193332" />
            <a href="http://corp.kaltura.com/products/video-platform-features">Video Platform</a>
            <a href="http://corp.kaltura.com/Products/Features/Video-Management">Video Management</a>
            <a href="http://corp.kaltura.com/Video-Solutions">Video Solutions</a>
            <a href="http://corp.kaltura.com/Products/Features/Video-Player">Video Player</a>
        </object>

And this is the javascript (forgive the console logs)

<script type="text/javascript">

        function onKdpReady(playerId) {
            console.log("fds");

            window.myKdp = document.getElementById(playerId);

            console.log(myKdp);
            console.log(mykdp.evaluate('{entryId}'));

            myKdp.addJsListener("freePreviewEnd", "FreePreviewHasEnded");
        }

        function jsCallbackReady(objectId) {
            window.myKdp = document.getElementById(objectId);

            console.log(myKdp);
            console.log(mykdp.evaluate('{entryId}'));

            myKdp.dispatchKdpEvent('doPlay');
            myKdp.addJsListener("freePreviewEnd", "FreePreviewHasEnded");
        }

        function FreePreviewHasEnded() {
            console.log("asdf");
        }

        function onKdpEmpty(playerId) {
            console.log("go");
        }
</script>

I am working off of the example located at: http://www.kaltura.org/kdp_js_api_demo_page.html

From what I have here, only the logs in the jsCallbackReady are ever being called, and the evaluate in that method returns absolutely nothing. The dispatch event call also does not start the video. What is weird is that if I change the movie param and the data attribute to the same ending as the example (_0/uiconf_id/1000106), then the jsCallbackReady doesn't get called but the onKdpReady does, and the event bind/evaluate doesn't work either. Is there something I am missing here, or something in the syntax that isn't right? I have been making alterations to the way things are called, and have even put a setTimeout on the page to bind later on past when the page has loaded, and it still doesn't bind.

Also, the player version of the demo is 2.7 while mine is 3.6.12.1. The video also has access control of 4 seconds of preview (for testing purposes, this will be longer in production).

If anyone has any ideas, that would help. Please though, don't just post a link to the javascript api documentation. I have read all over those pages (which lack any sort of example for a base start) and have not found any solutions.

Thanks

Joined: 02/22/2009
Points: 76

You may want to check out the feature hub:
http://html5video.org/kaltura-player/docs/

There are lots of working examples there. If you aim build a preview / buy flow you can check out this sample:
http://html5video.org/kaltura-player/modules/KalturaSupport/tests/Access...

Joined: 12/13/2012
Points: 9

I'll take a look at those and see what I come up with. Thanks for the input. I am using the flash version of the player, but I will see what I can move over from these html5 examples.

Joined: 01/14/2013
Points: 13

This old url :
http://cdnsecakmi.kaltura.com/p/243342/sp/24334200/flvclipper/entry_id/1...
return full video instead of preview?

Joined: 12/19/2013
Points: 128

Needed to compose you a word regarding the nice opinions you have contributed. Your good knowledge in playing with all the pieces is very useful. To be honest, this has been one outstanding blog
phone number for income support

Joined: 02/22/2009
Points: 76

The feature hub is for both HTML5 and flash. The api shown there should work for both.

Joined: 12/13/2012
Points: 9

I have tried building the sample provided, but it seems that I still can't get it to work. Here is an example of what I have got:

Javascript:

var myKdp = null;
var myId = null;

window['doPurchaseDialog'] = function () {

    console.log("asdf");
    console.log(myId);

    var pos = $('#' + myId).position();

    $('#' + myId).after(
    $('<div />').append(
    $('<h2>Sample purchase flow:</h2>'),
    $('<br />'),
    $('<button />')
    .attr('type', 'button')
    .html('simulate purchase')
    .click(function () {
        // set to loading
        console.log("adf");
        $('.myPurchaseDialog').html('loading ...');
        // Query the service for a ks:

    })
    )
    .addClass('myPurchaseDialog')
    .css({
        'position': 'absolute',
        'top': pos.top,
        'left': pos.left,
        'width': "400px",
        'height': "330px",
        'opacity': .8,
        'background-color': 'black',
        'color': 'white'
    })
    )
}

$(function () {

    $(".videoPlayerWrapper").each(function () {

        var _this = $(this);
        myId = _this.attr("id");
       
        var wid = _this.data("wid");
        var ui = _this.data("uiconfig");
        var vid = _this.data("video");

        kWidget.embed(_this.attr("id"), {
            'wid': wid,
            'uiconf_id': ui,
            'entry_id': vid,
            'flashvars': {
                'disableAlerts': true
            },
            'readyCallback': function (playerId) {

                console.log("callback");

                myKdp = $('#' + playerId)[0];

                myKdp.addJsListener('freePreviewEnd', 'doPurchaseDialog');
            }
        });

    });
});

Html

<div id="kaltura_wrapper_1_tyan50je" style="width:1000px;height:560px;" class="videoPlayerWrapper" data-video="1_tyan50je" data-uiconfig="9193302" data-wid="_1104952"></div>

Note: There is only one player on the page, so the jquery each will only have one item to go through. I somehow got the console logs in the doPurchaseDialog to fire once, but can't ever seem to get them to call again no matter what I change. The video though shows up fine and plays fine.

Any ideas on what I am still missing?

Joined: 12/13/2012
Points: 9

Quick update on this. It is working if firefox, but not Chrome or IE.

Joined: 06/27/2013
Points: 18

I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title with good description.
Web Design New York

Joined: 10/23/2013
Points: 6

I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title with good description.Benefits of phen375

Joined: 10/23/2013
Points: 4

I have explain so many article of this site in which some of them were very intresting and inspiring.
http://www.steamlite.co.uk/

Joined: 10/24/2013
Points: 6
Joined: 10/24/2013
Points: 6

I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title with good descriptionbest carry on luggage

Joined: 10/25/2013
Points: 5

I'll take a look at those and see what I come up with. Thanks for the input. I am using the flash version of the player, but I will see what I can move over from these html5 examples.
fastest vpn

Joined: 12/19/2013
Points: 128

I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post.
sky customer service telephone number

Joined: 11/01/2013
Points: 4

I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title
life ins

Joined: 11/13/2013
Points: 5
Joined: 12/02/2013
Points: 5

I'll take a look at those and see what I come up with. Thanks for the input. I am using the flash version of the player, but I will see what I can move over from these html5 examples.

digital marketing phoenix

Joined: 12/04/2013
Points: 8

I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title with good description.
http://www.musclefactor-x.blogspot.com

Joined: 12/10/2013
Points: 5

I'll take a look at those and see what I come up with. Thanks for the input. I am using the flash version of the player, but I will see what I can move over from these html5 examples. pay day loans
http://www.personalcashadvance.com/

Joined: 12/12/2013
Points: 5

I'll take a look at those and see what I come up with. Thanks for the input. I am using the flash version of the player, but I will see what I can move over from these html5 examples.
http://www.actionaffiliatesgreenville.com/

Joined: 12/15/2013
Points: 5

I'll take a look at those and see what I come up with. Thanks for the input. I am using the flash version of the player, but I will see what I can move over from these html5 examples..
car insurence.
http://www.carinsurancerates.com/

Joined: 12/17/2013
Points: 4

I have explain so many article of this site in which some of them were very intresting and inspiring.This article has good title with good description.
automobile insurance for used cars

Joined: 12/25/2013
Points: 66

seems to stipulate or is this just a statistical artifact within an aggregated narrative about women that's even harder to swallow sky customer service

Joined: 01/08/2014
Points: 4

it is real that it is a good player and I will use it often for sure!
http://www.schwabingzahnarzt.de

Joined: 12/16/2013
Points: 35

GOOD
hidemyass