Embedding Flash movies in an XPage

I am currently working on an application to distribute movies across the organisation. Something similar as OpenTV on OpenNTF, but then 99% based upon XPages technology.

The movies I have are curently all in FLV (Flash Video) format which is fine for me.

I have taken a look at HTML5 and video, but we still have many Internet Explorer 7 installations which does not seem to run with HTML5 media Libraries that contain fallback scenarios :-/

Therefor I believe I am stucked for now with an Flash Video based solution.

Since I have no experience at this point with integrating Flash in XPages I wonder if you have any recommendations or sample code?

OpenTV seems to be using a JS Library called Swfobject which seems to do the job just fine…

Advertisements

9 thoughts on “Embedding Flash movies in an XPage

  1. Mark Leusink 2010-December-29 / 12:47 pm

    Hi Patrick,

    I have quite some experience with embedding video in web applications. I have been using an open source product called “JW Player” to do so and can highly recommend it.

    If I’m not mistaken that player also uses the SWFObject library to create the actual objects.

    • Patrick Kwinten 2010-December-29 / 2:56 pm

      Hi Mark, I have taken a look at JW Player which seems promosing, also the setup wizard is of great help. Thanks!

    • Patrick Kwinten 2010-December-29 / 3:54 pm

      This is how I solved the problem via JW Player:

      <div id=”preview”>
      The player will show soon in this section…
      </div>
      <xp:scriptBlock id=”scriptBlock1″ type=”text/javascript”
      src=”../swfobject.js” />

      <xp:scriptBlock id=”scriptBlock2″>
      <xp:this.value><![CDATA[thumb = “#{javascript:var doc:NotesDocument = movie;var thumb = doc.getItemValueString(“Tx_DspMovieThumb”);return thumb;}”;
      movie = “#{javascript:var doc:NotesDocument = movie;var moviefile = doc.getItemValueString(“Tx_DspMovie”);return moviefile;}”;
      ref=”#{javascript:var doc:NotesDocument = movie.getDocument();return doc.getUniversalID();}”;
      ref += “/$FILE/”;
      var so = new SWFObject(‘../player.swf’,’ply’,’470′,’320′,’9′,’#000000′);
      so.addParam(‘allowfullscreen’,’true’);
      so.addParam(‘allowscriptaccess’,’always’);
      so.addParam(‘wmode’,’opaque’);
      so.addVariable(‘image’,thumb);
      so.addVariable(‘file’,ref + movie);
      so.addVariable(‘controlbar’,’over’);
      so.addVariable(‘autostart’,’true’);
      so.addVariable(‘bufferlength’,’20’);
      so.addVariable(‘fullscreen’,’true’);
      so.addVariable(‘stretching’,’fill’);
      so.write(‘preview’);]]></xp:this.value>
      </xp:scriptBlock>

      For the thumb and moviefile values I have computed fields in the Notes form.

      Thumb:
      var_AttachNames := @LowerCase(@AttachmentNames);
      var_Extension := @Right( var_AttachNames ; “.” );
      var_JPGPosition := @Member(“jpg”;var_Extension);
      var_JPEGPosition := @Member(“jpeg”;var_Extension);
      var_GIFPosition := @Member(“gif”;var_Extension);

      @If(
      var_JPGPosition != 0;
      var_AttachNames[var_JPGPosition];
      @If(
      var_JPEGPosition != 0;
      var_AttachNames[var_JPEGPosition];
      @If(
      var_GIFPosition != 0;
      var_AttachNames[var_GIFPosition];
      “”)))

      Moviefile:

      var_AttachNames := @LowerCase(@AttachmentNames);
      var_Extension := @Right( var_AttachNames ; “.” );
      var_FLVPosition := @Member(“flv”;var_Extension);
      var_SWFPosition := @Member(“swf”;var_Extension);

      @If(
      var_FLVPosition != 0;
      @URLEncode(“UTF-8”;var_AttachNames[var_FLVPosition]);
      @If(
      var_SWFPosition != 0;
      @URLEncode(“UTF-8”;var_AttachNames[var_SWFPosition]);
      “”))

      Works like a charm !

  2. Ulrich Krause 2010-December-29 / 7:05 pm

    Indeed, great stuff. Did you get the yt.swf running? I added the code from the wizzard and the player and the RSS feed displays, but I always get an error 2035 when I try to play the video. yt.swf is in the same folder as player. I imported the files to the file section of my application.

  3. Neil 2010-December-30 / 12:34 pm

    I must go back and do another version of openTV, I never got around to cleaning up the code, and adding a whole bunch of new sexy features.

    JWplayer is very good, and very simple to use…

    • Patrick Kwinten 2010-December-30 / 1:54 pm

      Hej Neil,

      I guess maintaining the same app with XPages is much easier.

  4. Ulrich Krause 2010-December-30 / 1:46 pm

    yt.swf works, when i put the file on the server. But I always get an #2035 error, when I import the file as file resource

    • Patrick Kwinten 2010-December-30 / 1:54 pm

      I am not using that feature, since it is connected to movies on YouTube?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s