Custom url for video

Is it possible to play a video in kaltura player without uploading it to the server? So is it possible to give the link of a youtube video in entry_id field? Or is there some other flashvar entry possible for custom video url?

I read in a stackoverflow question about a proxy server being implemented - https://github.com/kaltura/mwEmbed/tree/proxyPlayer. Will I be able to give a custom url using that proxy?

Hello,

The Kaltura player cannot play anything unless it has a Kaltura server to talk to.
You can, if you do have a Kaltura server, create an entry that live streams the file from a CDN for example, like this:
http://knowledge.kaltura.com/configuring-live-streaming-kmc-account-using-bitgravity-account

But a Kaltura server is still needed.

Hey Jess,

I am working with mwEmbed repository and am trying to put some console logs in mw.KAdPlayer.js. However, I dont see that code reflected when I open my html page which contains the kaltura video player.

I am loading only mwEmbedLoader.php in my html page.

However, I think the load.php files comes from the inclusion of the 1st script that contains my partnerId and uiconf_id. If I include only mwEmbedLoader.php I get a console error saying
mwEmbedLoader.php:1 Uncaught SyntaxError: Unexpected token <
testKalturaVASTAd.html:19 Uncaught ReferenceError: kWidget is not defined

Am I missing something?

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.