You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Forum user: joelhulen

Basic information

Registered Feb 19, 2009
Last login Apr 22, 2009
Forum posts 11
Direct URL http://www.flowplayer.org/forum/users/8486

Latest forum posts

Posts:

Registered:

» » Submitted: Changes to Captions plugin source code

Posted: Apr 22, 2009

Thanks!

I just looked at the committed file, and if a fileExtension value is not passed in, the file extension is still being extracted from the captionURL value like so: captionFile.substr(-3)

Since 'tx3g' and 'qtxt' file types (for eventual parsing, I suppose) can be passed in, the parseCuePoints function will only grab 'x3g' and 'txt' respectively.

This being the case, I recommend altering captionFile.substr(-3) to:

var extensionIndex:Number = captionFile.lastIndexOf( '.' );
var extension:String = captionFile.substr( extensionIndex + 1, captionFile.length );

Just my $0.02 :)

Posts:

Registered:

Submitted: Changes to Captions plugin source code

Posted: Apr 22, 2009

Here are the full details of my finished changes to the Captions plugin. I have submitted my changes to support for their consideration in including the changes as part of the core, per Buzz:

I have modified the Caption class file (Caption.as) and made comments marking my changes within.

Here's a link to my modified file:http://www.hirodev.com/flowplayer/Caption.as.txt

We ran across an issue with the captions plugin when we started pulling our Timed Text xml files from a Liferay Document Library. In order to retrieve the file, a dynamic URL is used that comprises of a call to a server resource (eg. /c/document_library/get_file?uuid=8cc1d1a6-a803-4a0c-8d11-b7349017366a&groupId=27265). This does not point to a static resource such as an actual file name with a file extension. Since the parseCuePoints function in the captions plugin decides how it can parse the file based upon file type, determined by the extension, these dynamic paths were rendered useless.

What I've done is to create a new public function named loadCaptionsExt that accepts 3 parameters (instead of the 2 accepted by loadCaptions): clipIndex, captionURL, and fileExtension.

The fileExtension parameter is used to pass in the extension of the caption file if the URL does not contain it. What should be passed in is the extension after the dot ("xml" instead of ".xml"). When parseCuePoints receives this value, it checks it agains the CaptionFileTypes class. Otherwise, the file extension found in the captionURL is used for evaluation.

I also modified loadCaptionFile to accept the additional fileExtension parameter, and the parseCuePoints function to add the fileExtension parameter and perform related logic if not null.
In the parseCuePoints function we first evaluate whether the fileExtension parameter is null. If not, use that as the extension value, otherwise, evaluate the captionFile string to extract the extension and compare to the CaptionFileTypes class. Instead of determining the file extension by evaluating the last 3 characters in the path, I would recommend using the lastIndexOf method to find the last "." and extract the extension from there. We want this to be flexible enough to handle varying file extension lengths. Here's an implementation example:
---------------------------------------------------------------------
var extensionIndex:Number = captionFile.lastIndexOf( '.' );
var extension:String = captionFile.substr( extensionIndex + 1, captionFile.length );
---------------------------------------------------------------------
I did not test this, so I did not implement it as a result. What I did test was the logic you see below that includes the fileExtension parameter, and so far it works on both IE and Firefox on Windows. You may choose to do more extensive testing.

An example implementation of the loadCaptionsExt function from javascript:

          // In this case, we are passing in "xml" as the 3rd parameter since we are using Timed Text files. If we were using SubRip, we'd pass in "srt" instead.
          // curCC is a string parameter of our dynamic URL that does not contain an actual file name.
          flowplayer("player").getPlugin("captions").loadCaptionsExt(0,curCC,"xml");
I would love to see these changes implemented in the core source code for the captions plugin. This way, when the next version comes out, I won't have to modify the source code again with my changes. Also, I'm sure plenty of others will be able to benefit as well.

Posts:

Registered:

How To: Compile a flash-based plugin

Posted: Apr 22, 2009

I recently had to make changes to the Captions plugin to add additional functionality. I downloaded the source code, made my changes to the Actionscript files, and then.... ummm... what do I do?

I tried following the documentation about authoring Flash plugins http://www.flowplayer.org/documentation/developer/writing-flash-plugins.html), but I found the instructions to be incomplete, at least for me.

After quite a bit of trial and error, I came up with the following things I needed to do within my Windows environment to successfully compile my new Captions plugin. Hopefully this helps someone else banging their head:

To compile, run the following command at the Command Prompt:

Z:\apache-ant-1.7.1\bin>ant -file z:\flowplayer\Core\flowplayer.devkit\flowplayer.captions\build.xml

Requirements:

Posts:

Registered:

Changes to Captions plugin source code

Posted: Apr 21, 2009

What I meant was, what is the proper procedure for submitting my code changes for consideration of inclusion to the SVN/core source repository?

Posts:

Registered:

Captions CC button - how to toggle visibility?

Posted: Apr 21, 2009

The addition of the CC button with the Captions plugin is great! The problem is, I haven't been able to figure out how to toggle the button's visibility during runtime. It would make sense that if the clip's showCaptions property is set to false, the button would be hidden. Alas, this is not the case.

I've tried altering the new button property of the Captions plugin during runtime, but this doesn't seem to work either. I need to be able to alter this behavior during the clip's/player's onPlay event, depending upon whether the current clip has a Closed Captioning file or not. If there's no out-of-the-box way to accomplish this, I'll need to alter the plugin's source code once again.

Thanks in advance - Joel

Posts:

Registered:

Changes made - where should I post?

Posted: Apr 21, 2009

I made the source code changes I posted about, compiled, deployed to my server, and everything works!

So, where should I post my changes, or should I just attach the modified Captions.as file here?

Joel

Posts:

Registered:

Changes to Captions plugin source code

Posted: Apr 16, 2009

Hello, I recently came across an issue with the Captions plugin. We are storing our Timed Text caption files within a document library. In order to retrieve the document, we send an HTTP request to a resource locator service in a series of query strings (eg. /getfile?fid=xxxx&groupid=23894). I then pass that dynamic URL to the loadCaptions function of the Captions plugin along with the clip index.

This is where things fall apart. The protected parseCuePoints function evaluates the file extension of the captionFile parameter (URL to the Timed Text file in my case) in order to determine what type of file it is and how to proceed with the parsing. Obviously, I'm not passing in a file path that contains the .XML file extension for my Timed Text file.

What I am going to do is overload the public loadCaptions function (and protected parseCuePoints function) to accept a file extension parameter so the parseCuePoints can use this parameter value if populated.

What I want to know is how this functionality can be added to the core Captions plugin project so future releases have this capability? Is this something the flowPlayer project team should add, or should I submit my code changes somewhere once I've made them?

Thanks,
Joel

Posts:

Registered:

FIXED: Create playlist with some videos having captions

Posted: Mar 28, 2009

Alright, after studying the captions.as file in the flowplayer.captions source code, I've figured out the publicly exposed function to call: loadCaptions()

This function has two parameters: clipIndex:int and captionUrl:String

The clipIndex in my case will always be 0 since when using an external playlist, the player has one clip loaded at a time.

The captionUrl is the path to my xml file in either Timed Text or SubRip format.

Here's an example of calling this method:


$f().getPlugin("captions").loadCaptions(0,captionUrl);

What I am doing is dynamically writing out my HTML-based playlist and including some hidden DIVs for metadata, such as the path to the captions file. I am also accessing visible information at the same time to do things such as change the title above the player to the video title, and populating a description box below the player. Here's my function:


$f("player").onStart(function(clip) { 
 
		var videoTitle = $("#playlist a[href='" + clip.url + "'] span.videoTitle").html();
		var videoDescription = $("#playlist a[href='" + clip.url + "'] div.description").html()
		
		$("#videoSectionTitle").html("<h1>" + videoTitle + "</h1>");
		$("#eventInfo").html(videoDescription)
		
		var captionUrl = $("#playlist a[href='" + clip.url + "'] div.captionUrl").html();
		
		if (captionUrl.length>0) {
			$f().getPlugin("captions").loadCaptions(0,captionUrl);
		}

	}

Hopefully this saves someone else a bunch of time and forehead slapping!

Joel

Posts:

Registered:

Create playlist with some videos having captions

Posted: Mar 25, 2009

Hello, I've seen it mentioned on this forum that the captions plugin is fully compatible with the playlists plugin. My question is, how? Does anyone have an example of the two working together?

I have implemented a playlist in HTML, and I have also (unsuccessfully) attempted to implement it in javascript:

HTML:http://app1.ppgportal.com/moodle/joel/videoPlayer.php

Javascript:http://app1.ppgportal.com/moodle/joel/index.html

There may be some videos with closed captioning information that I would like to have display their captioning, especially if the format is an XML-based timed text file.

So far as I can see, the only way to really implement the captionUrl parameter is in the Clip object. I don't see how I can do this from a playlist. Can anyone help??

Thanks!
Joel

Posts:

Registered:

Pseudostreaming from Tomcat??

Posted: Feb 22, 2009

Hello, I'm trying to configure Tomcat to stream the flash using the flowplayer pseudostreaming plugin. It says it can be done but I have not found out the howto's for Tomcat. Plenty for other servers but not tomcat.

Does anyone know if pseudostreaming from Tomcat is possible?

Posts:

Registered:

Best storage for streaming video files + Liferay integration

Posted: Feb 19, 2009

We have built a portal using Liferay (java-based) and a large part of our site content will be in the form of videos, esp. flv. For the best end-user experience, we would like to implement some form of pseudo/streaming. We have been trying to figure out whether to use Liferay's document library, Alfresco, or a folder on the file system to store video content. Any guidance here would be great.

What I am really trying to figure out is whether the storage location matters for videos used for streaming purposes vs. videos that will be progressively downloaded. Does anyone know if storing in a database/virtual folder would limit a streaming server's capability to stream that video content to the user? We are looking at using Red5 or lighttpd for streaming, most likely.

Thanks in advance!