Custom url for video

Hi,
You can play videos that are not hosted on the Kaltura server by using a mediaProxy override (example).
If you use player version 2.36 and up, you don’t need to override the entire mediaProxy object - you can do partial overrides (for example override only the source).
As for the error you encounter loading the player - seems like a configuration issue. Loading mwEmbedLoader.php is enough. Verify your LocalSettings.php file exists and configured correctly.

Amir

Hey thanks!

I have been trying to work the example you suggested. However, no the video just refuses to play on my webpage and there are no errors in the console as well. Here’s my code:

<html>
<head>
<script src="http://cdnapisec.kaltura.com/p/2027961/sp/202796100/embedIframeJs/uiconf_id/32020091/partner_id/2027961"></script>
<!--<script src="/kWidget/kWidget.js"></script>-->
<!--<script src="mwEmbedLoader.php"></script>-->
<!--<script src="load.php"></script>-->
<div id="kaltura_player_1446547025" style="width:430px;height:330px;" itemprop="video" itemscope itemtype="http://schema.org/VideoObject" >
<!-- Search engine metadata, based on schema.org/VideoObject -->
<span itemprop="description" content="test folgers coffe"></span>
<span itemprop="name" content="FolgersCoffee_mpeg"></span>
<span itemprop="duration" content="60"></span>
<span itemprop="thumbnailUrl" content="http://cfvod.kaltura.com/p/2027961/sp/202796100/thumbnail/entry_id/1_3gmgqn2e/version/100007/acv/171"></span>
<span itemprop="width" content="430"></span>
<span itemprop="height" content="330"></span>
</div>
<script>
kWidget.embed({
    targetId: "kaltura_player_1446547025",
    wid: "_2027961",
    uiconf_id: "32020091",
    cache_st: "1446547025",
    entry_id: "1_3gmgqn2e",
    flashvars: {
        "vast": {
            "prerollUrl" : "http://projects.kaltura.com/mdale/hotelVastAd.xml?myRefurl=http%3A//myref.com/%3Ffoo%3Dbar%26cat%3Ddog{utility.nativeAdId}",
            "numPreroll" : "1",
            "preSequence" : "1",
            "htmlCompanions" : "testCompanion:300:250;testLongCompanion:728:90;",
            "timeout" : "4",
            "storeSession" : false,
            "skipOffset" : "5",
            "unescapeAdUrls" : false
        },
        "skipBtn": {
            "skipOffset" : "5",
            "label" : "Skip Ad"
        },
        "noticeMessage": {
            "text" : "Advertisment {sequenceProxy.timeRemaining|timeFormat}"
        },
        "adsOnReplay" : true,
        "externalInterfaceDisabled" : false
    }
})
</script>
<body>
<script>
kWidget.addReadyCallback(function(playerId){
        kdp.sendNotification( "changeMedia", { 'entryId' : '1_fra2wjpe'});
});
</script>
</body>
</html>

What could be the issue?

Also in the example link that you sent, I can see the same video playing in the first and the second player(the second player is supposed to override the media). Is the example broken?

Hi,
The code you attached is not the code from the example I send you.
You need to override the mediaProxy object. It has nothing to do with VAST.

Yep you are right, this is not the example you shared. I was actually trying a few options.
So I gave a try to the example you suggested too. However the player refuses to even load :(.
Here’s my code:

<html>
<head>
    <title></title>
    <script src="http://cdnapisec.kaltura.com/p/2027961/sp/202796100/embedIframeJs/uiconf_id/32020091/partner_id/2027961"></script>
    <!--<script src="/kWidget/kWidget.js"></script>-->
    <!--<script src="mwEmbedLoader.php"></script>-->
    <!--<script src="load.php"></script>-->
<div id="kaltura_player_1446547025" style="width:430px;height:330px;" itemprop="video" itemscope itemtype="http://schema.org/VideoObject" >
    <!-- Search engine metadata, based on schema.org/VideoObject -->
    <span itemprop="description" content="test folgers coffe"></span>
    <span itemprop="name" content="FolgersCoffee_mpeg"></span>
    <span itemprop="duration" content="60"></span>
    <span itemprop="thumbnailUrl" content="http://cfvod.kaltura.com/p/2027961/sp/202796100/thumbnail/entry_id/1_3gmgqn2e/version/100007/acv/171"></span>
    <span itemprop="width" content="430"></span>
    <span itemprop="height" content="330"></span>
</div>
<!--<script>-->
    <!--kWidget.embed({-->
        <!--targetId: "kaltura_player_1446547025",-->
        <!--wid: "_2027961",-->
        <!--uiconf_id: "32020091",-->
        <!--cache_st: "1446547025",-->
        <!--entry_id: "1_3gmgqn2e"-->
    <!--});-->
<!--</script>-->
<body>
<script>

    var jsonConfig	= {
        "plugins":{
            "topBarContainer": {},
            "titleLabel": {},
            "controlBarContainer": {
                "hover": true
            },
            "largePlayBtn": {},
            "scrubber": {
                'thumbSlicesUrl': '{mediaProxy.entryMetadata.thumbSlicesUrl}'
            },
            "playPauseBtn": {},
            "volumeControl": {},
            "fullScreenBtn": {},
            "durationLabel": {},
            "currentTimeLabel": {},
            "sourceSelector": {},
            "closedCaptions": {},
            "watermark": {
                "cssClass": "topLeft",
                "img": "http://www.kaltura.com/content/uiconf/kaltura/kmc/appstudio/kdp3/exampleWatermark.png"
            },
            "logo": {},
            "moderation":{},
            "infoScreen": {},
            "share": {},
            "related": {},
            "playbackRateSelector" :{}
        },
        "uiVars":[
            {
                "key":"Kaltura.UseAppleAdaptive",
                "value":false,
                "overrideFlashvar":false
            }
        ],
        "layout":{
            "skin": "kdark",
            "cssFiles":[ ]
        }
    };

    var mediaProxyEntry = {
        'preferedFlavorBR': 1600,
        'entry':{
            'id': "key_1",
            'name': "My ToolKit Video",
            "description": "Kaltura Player Toolkit Description.",
            "plays":1234,
            "views":47332,
            "duration":114,
            "createdAt":1379965720,
            "thumbnailUrl": 'http://cdnbakmi.kaltura.com/p/2027961/sp/202796100/thumbnail/entry_id/1_sf5ovm7u/version/100003/width/640'
        },
        'entryCuePoints': [{
            "protocolType": 1,
            "adType": 1,
            "cuePointType": "adCuePoint.Ad",
            "startTime": 4936,
            "sourceUrl": "http://projects.kaltura.com/mdale/hotelVastAd.xml"
        }],
        "contextData":{
            'isCountryRestricted': false
        },
        'entryMetadata': {
            'thumbSlicesUrl': 'http://cdnbakmi.kaltura.com/p/2027961/sp/202796100/thumbnail/entry_id/1_sf5ovm7u/version/100003/width/100/vid_slices/100',
            'AgeGroup': "16"
        },
        'sources':[
            {
                "src":"http://cdnbakmi.kaltura.com/p/2027961/sp/202796100/playManifest/entryId/1_sf5ovm7u/flavorId/1_4j0omqcl/format/url/protocol/http/a.webm",
                "width":"624",
                "height":"352",
                "bandwidth":"740352",
                "type":"video/webm; codecs=\"vp8, vorbis"
            },{
                "src":"http://cdnbakmi.kaltura.com/p/2027961/sp/202796100/playManifest/entryId/1_sf5ovm7u/flavorId/1_d2uwy7vv/format/url/protocol/http/a.mp4",
                "width":"640",
                "height":"360",
                "bandwidth":"1101824",
                "type":"video/mp4; codecs=\"avc1.42E01E, mp4a.40.2"
            },{
                "src":"http://cdnbakmi.kaltura.com/p/2027961/sp/202796100/playManifest/entryId/1_sf5ovm7u/flavorId/1_jl7y56al/format/url/protocol/http/a.mp4",
                "width":"1280",
                "height":"720",
                "bandwidth":"24117248",
                "type":"video/mp4; codecs=\"avc1.42E01E, mp4a.40.2"
            },
            {
                "src":"http://cdnbakmi.kaltura.com/p/2027961/sp/202796100/playManifest/entryId/1_sf5ovm7u/flavorIds/1_jl7y56al/format/applehttp/protocol/http/a.m3u8",
                "type":"application/vnd.apple.mpegurl"
            }
        ]
    }
    // do the embed:
    kWidget.embed('kaltura_player', {
        'wid' : '_2027961',
        'flashvars':{
            // json player config
            'jsonConfig':jsonConfig,
            // runtime overrides:
            'mediaProxy.preferedFlavorBR': 1600,
            // per entity settings:
            'mediaProxy': mediaProxyEntry
        }
    });
    kWidget.addReadyCallback(function(playerId){
//        window.kdp = document.getElementById("kaltura_player_1446547025");
        window.kdp = document.getElementById(playerId);
        kdp.sendNotification( "changeMedia", { 'entryId' : '1_fra2wjpe'});
    });

</script>
</body>
</html>

I might be missing something silly. Can you guide me around this one?

the first parameter of the embed function is the DIV id in which you want to embed the player, in your case it should be “kaltura_player_1446547025”.
Then the player loads but not as it should. I think the example it a bit too complicated. What are you trying to achieve at the end? Playing a local movie in the player?

Yes I am trying to play a local movie in the player. Is this possible using media proxy?

OK - so here is a simple demo code that does that. Note that this of course loads a video from my personal site so please change it to your local files. This demonstrates overriding the poster image, video file and video title.

<html>
<head>
</head>
<script src="http://cdnapisec.kaltura.com/p/2027961/sp/202796100/embedIframeJs/uiconf_id/32020091/partner_id/2027961"></script>
<div id="kaltura_player_1447766358" style="width: 560px; height: 395px;" itemprop="video" itemscope itemtype="http://schema.org/VideoObject">
</div>
<script>
    kWidget.embed({
        "targetId": "kaltura_player_1447766358",
        "wid": "_2027961",
        "uiconf_id": 32020091,
        "flashvars": {
            'titleLabel':{
                'plugin': true
            },
            'mediaProxy': {
                'entry':{
                    'id': "1",
                    'name': "External video: Wildlife",
                    "description": "Description here",
                    "thumbnailUrl": 'http://amirush.com/vidmo/vid/poster.jpg'
                },
                'sources':[
                    {
                        "src":"http://amirush.com/vidmo/vid/wildlife-small.mp4",
                        "width":"640",
                        "height":"360",
                        "bandwidth":"9688824",
                        "type":"video/mp4; codecs=\"avc1.42E01E, mp4a.40.2"
                    }
                ]
            }
        }
    });
</script>
</body>
</html>

Works like a charm! thank you so much :smile:

Sure - I’ve just edited the demo code to use your partner ID and UIConf ID - so please update it as well so you won’t use my account. Thanks!

Yes I did change the partnerId and UIConf ID before trying out your example so that I use my account and am sure things work :slight_smile: Thanks a lot!

thanks - don’t forget to update it in the script tag src as well…

@amir_chervinsky1
How is the bandwidth (in mediaproxy) calculated?

This is the bandwidth of the currently selected flavour. It can be seen in the KMC.

@amir_chervinsky1
Ok, It’s working for me, but I have this behavior, if in the source I have more than 2 mp4 flavors I get exception.
Does it make sense?

No, this is not expected. most sources have more than one mp4 flavour.

@amir_chervinsky1
Below are 2 samples:
This one works
http://whitenblue.com/kaltura/ext2.html
This one doesn’t
http://whitenblue.com/kaltura/ext1.html
The only difference is that I removed one of the sources (and it doesn’t matter which one I remove, removing one of them cause this to work)

Well,

It is strange, it as if there is a length limit to the mediaProxy. The less attributes I set on each source, the more sources I can get:
http://whitenblue.com/kaltura/ext3.html

The limit is on the iframe request length. If you run http://whitenblue.com/kaltura/ext1.html?debugKalturaPlayer you will see an error in the console that jQuery is missing. This is since the iframe request length is larger than 2083 characters. If you add a link to jQuery in your head tag - the player loads. This should probably be fixed on the player side but should be a sufficient workaround for now.

Thanks It is working with the addition of jquery