new C# project

5 replies [Last post]
Joined: 01/13/2011
Points: 12

I am starting a new C# project and would be interested in talking to anyoen who has done or is still working on the same. thanks!

-David

Joined: 05/04/2010
Points: 3

I'm looking to start a new C# project as well. Have you had any success with the integration?
The project solution provided isn't quite what I expected. I was hoping for an example as to how it was integrated.

If you've gotten anywhere with it, can you share an example?

-mb

Joined: 05/04/2010
Points: 3

I think I got somewhere with Kaltura's developers.
I will share with you my findings.... if you are still interested.

Joined: 05/04/2010
Points: 3

After going back and forth with Kaltura's support and the head honcho of this Community, I decided that more people who use DOT NET are going to want to know how to do this and don't want to fight with people to get a hold of their documentation... so, that being said, this is what I came up with and how I did it...

ENJOY!

//
//**************************************
//*   Kaltura Integration in DOT NET   *
//*      Created By Mark Bogner        *
//*            2/11/2011               *
//**************************************
//

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Data.SqlClient;
using System.Text;

//First  I created A <div> on the front end and called it, "plchldrVideo"
//Making it a server convtrol (runat="server").
//
//           <div id="plchldrVideo" runat="server"></div>
//
//
//

   protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
           RenderContents(); //Calling the function on page load
        }

    }  

   protected void RenderContents()
    {
        //Clear out anything in the <div> created on the front end
        plchldrVideo.Controls.Clear();

        //Create a NEW <div> to rest inside this one.
        System.Web.UI.HtmlControls.HtmlGenericControl VideoDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("div");

        //Give it a name
        VideoDiv.ID = "VideoDivCode";

        //Give it some styling
        VideoDiv.Style.Add(HtmlTextWriterStyle.Width, "460px");
        VideoDiv.Style.Add(HtmlTextWriterStyle.Height, "317px");
        VideoDiv.Style.Add(HtmlTextWriterStyle.MarginTop, "5px");
        VideoDiv.Style.Add(HtmlTextWriterStyle.MarginBottom, "10px");

        //This the inner HTML <OBJECT> code that Kaltura uses to "embed" the player on a page - BUT it's calling the next fucntion
        VideoDiv.InnerHtml = videoString();

        //Add the control
        plchldrVideo.Controls.Add(VideoDiv);
    }

    private String videoString()
    {
        //This is what is actually embeded in the previous function.
        //For the querystring, I would use this "0_ex4i45f5" as the value of the EntryID
        //Create a string builder
        StringBuilder sb = new StringBuilder();

        //What video do I want to load?
        //I decided that I wanted to load a specific video from a menu of choices, much like YouTube.
        //(example: <a href="http://www.youtube.com/watch?v=ZW4LhWEbzBA" title="http://www.youtube.com/watch?v=ZW4LhWEbzBA">http://www.youtube.com/watch?v=ZW4LhWEbzBA</a>) <- That's my daughter's video, btw.
        //In this case, the querystring we're looking for is EntryId - but in Kaltura's terms is: "entry_id"

        string EntryId = Request.QueryString["EntryId"];
        string ContId = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque euismod scelerisque odio. In ipsum lectus, faucibus at, rutrum ac, suscipit at, sapien.";
        sb.Append("<object id=\"kaltura_player\" name=\"kaltura_player\" type=\"application/x-shockwave-flash\" allowFullScreen=\"true\" allowNetworking=\"all\" ");
        sb.Append("allowScriptAccess=\"always\" height=\"317\" width=\"460\" ");
        sb.Append("xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\" rel=\"media:video\" ");
        sb.Append("resource=\"http://www.kaltura.com/index.php/kwidget/cache_st/1297462495/wid/_275522/uiconf_id/1645332/entry_id/" + EntryId + "\" ");
        sb.Append("data=\"http://www.kaltura.com/index.php/kwidget/cache_st/1297462495/wid/_275522/uiconf_id/1645332/entry_id/" + EntryId + "\"> ");
        sb.Append("<param name=\"allowFullScreen\" value=\"true\" />");
        sb.Append("<param name=\"allowNetworking\" value=\"all\" />");
        sb.Append("<param name=\"allowScriptAccess\" value=\"always\" />");
        sb.Append("<param name=\"bgcolor\" value=\"#000000\" />");
        sb.Append("<param name=\"flashVars\" value=\"&\" />");
        sb.Append("<param name=movie value=\"http://www.kaltura.com/index.php/kwidget/cache_st/1297462495/wid/_275522/uiconf_id/1645332/entry_id/" + EntryId + "\" />");
        sb.Append("<a href=\"http://corp.kaltura.com\">video platform</a> ");
        sb.Append("<a href=\"http://corp.kaltura.com/video_platform/video_management\">video management</a> ");
        sb.Append("<a href=\"http://corp.kaltura.com/solutions/video_solution\">video solutions</a> ");
        sb.Append("<a href=\"http://corp.kaltura.com/video_platform/video_publishing\">video player</a> ");
        sb.Append("<a rel=\"media:thumbnail\" href=\"http://cdnbakmi.kaltura.com/p/275522/sp/27552200/thumbnail/entry_id/" + EntryId + "/width/120/height/90/bgcolor/000000/type/2\">");
        sb.Append("<span property=\"dc:description\" content=\"" + ContId + "\" />");
        sb.Append("<span property=\"media:title\" content=\"Altus Premier Web Tools\" />");
        sb.Append("<span property=\"media:width\" content=\"460\" />");
        sb.Append("<span property=\"media:height\" content=\"317\" />");
        sb.Append("<span property=\"media:type\" content=\"application/x-shockwave-flash\" />");
        sb.Append("</object>");
        return sb.ToString();
    }

Joined: 01/05/2009
Points: 1697

Mark, thank you for sharing.

You might want to check out the best practice embedding of KDP: http://www.kaltura.org/apis/seo/seo_landing_page.zip

Whatever way you chose to render it from C# side, the result should be similar to the above link or to what the KMC embed looks like (same as you did in your example above).

Joined: 01/13/2011
Points: 12

Sorry I didn;t see this! We used MVC 2 on our site. it took some real tough work but I now have a thumbnail gallery, clicl on one and it loads the player with that video. Click the share button and the video is played on teh Facebook wall. Without that lame GIGYA!

email me david.carnley

at

gmail dot com and I can share some details.

http://www.peggybank.com/share/JRSimon9742 for example