RE: M4P From Document Library Won't Play

3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
Thanks to some help from the community I was able to get the full path to the videos that I've uploaded in the Document Library but for some reason they won't play through the Flash player. When I view source on the page I can get the URL to the video that's being passed in a Flash var, copy and paste it into my browser and it downloads the file, which will then play just fine, so I know that's not the problem. This site is being refactored from a PHP site and these are the same video files and the same Flash player that was used on the old site and it all worked fine there. What could be causing this problem?
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
Bump?
thumbnail
31576, modified 16 Years ago. Liferay Master Posts: 993 Join Date: 4/27/07 Recent Posts
Hi Dave,

I guess that you need to use a player (would be a flash player) in your custom portlet.

Or just just use RealPlayer ...

Can you share your flash player?

Thanks

Jonas Yuan

-----------------
Liferay Books

Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
I'm not sure I understand what you're saying. I am using a Flash player in the portlet, as I mentioned in my first post, and it's the same one that was being used on the old site. It's being embedded properly and it's showing up in the portlet it's just that the video won't play through it for some reason. Is there something about the Document Library that prevents video streaming or something?
thumbnail
31576, modified 16 Years ago. Liferay Master Posts: 993 Join Date: 4/27/07 Recent Posts
Hi Dave,

You may check the Video itself. For each document in Document Library, there is an URL.

Could you please check the URL of the Video? Can you download the Video by the URL?

Thanks

Jonas Yuan
--------------------
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
Yes. As I mentioned in my original post, I can download the file using the URL that is being passed to the Flash player. I don't think it's an issue with the Flash player because it's the same player and video file that are currently being used on the original site that we are refactoring for Liferay.
thumbnail
31576, modified 16 Years ago. Liferay Master Posts: 993 Join Date: 4/27/07 Recent Posts
Hi Dave,

Thank you.

Can you download the video and play it in your local player, like RealPlayer?

Hope that the video is in good status.

Thanks

Jonas Yuan
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
thumbnail
212638, modified 16 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
If you're passing in the URL as a Flash variable, are you remembering to replace all the ampersands in the URL with & character entities?
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
Yeah, I'm using HttpUtil.encodeURL() to do it. That should work, right?

@Jonas
I really appreciate you taking time to try to help me but please read my original post. So far every question you've asked me I answered there.
thumbnail
31576, modified 16 Years ago. Liferay Master Posts: 993 Join Date: 4/27/07 Recent Posts
Hi Dave,

Sorry to miss checking post original post. :-)

Doy you get the issue fixed?

It would be JavaScript conflicts issue. Not sure about your flasher player. For normal flash player, it uses JavaScript.

For example, the following is one flash player (using swfobject.js).


	
		<title>Video Preview</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="robots" content="noindex, nofollow">
		<script type="text/javascript" src="/cms_services/js/swfobject.js"></script>
	
	
	<script type="text/javascript">	
		var targetSWF = "/cms_services/street/video_240x180_standalone.swf";
		var skinSWF = "/cms_services/street/sesame_video_control_skin.swf";
		
		var configURL ="/cms_services/services?action=player&type=VIDEO&uid=<%= request.getParameter("uid") %>";
		
		var so = new SWFObject("/cms_services/street/loader.swf", "videoplayer", "300", "300", "9.0.115.0", "#FFFFFF");
		so.addParam("menu","false");
		so.addParam("wmode","transparent");
		so.addParam("allowScriptAccess","always");
	
		so.addVariable("targetSwf", escape(targetSWF));		
		so.addVariable("configUrl", escape(configURL));
		so.addVariable("skinUrl", escape(skinSWF));
		
		so.addVariable("jsShareMethod", "showShareDialog");
		so.addVariable("jsFavoriteMethod", "flash_addToMyStreet");
				
		so.addParam("menu","false");
		so.addParam("wmode", "transparent");
		so.addParam("allowFullScreen","true");
		
		so.write("videoplayer-container");
		window.document.videoplayer.focus();
		RightClick.init("videoplayer","videoplayer-container");
	</script>
	



It would be simple to debug JavaScript.

Jonas Yuan
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
It's all good. emoticon

No, I don't have it fixed yet but what you posted is very similar to what I'm doing. I'm using the latest version of SWFObject to embed the Flash player. I don't get any errors in the console though so I don't think it's a JavaScript issue. I'm kinda wondering if videos can't be streamed from Liferay for some reason.
thumbnail
212638, modified 16 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Edit: I didn't notice that there were multiple pages to this thread, oops. The text below assumes that you were embedding the flash using HTML rather than SWFObject, so feel free to ignore it if it doesn't apply to you.

For an actual solution, can you post the Javascript that winds up in the source code so we can see how the parameters wind up being set for the SWFObject? It could also be a problem with double-escaping.

Dave Willis:
Yeah, I'm using HttpUtil.encodeURL() to do it. That should work, right?

I believe so.

I came to the conclusion that the value wasn't escaped, because you indicated that you could copy-paste it directly from view-source. That URL-encoded value should not be something you can paste directly into your location bar to download the file. If you're manually escaping it before copy pasting into the location bar, I jumped to the wrong conclusion.

Just to verify, you're wrapping it with HttpUtil.encodeURL(), what you see in source should look something like this:

<param NAME="FlashVars" VALUE="paramName=http%3A%2F%2Flocalhost%2Fc%2Fdocument_library%2Fget_file%3FfolderId%3D1%26name%3DDLFE-1.mp4">


If your view-source does resemble the above, you can try replacing the ampersands with &amp; (so no URL encoding) to see if that works better. I've encountered functioning examples which embed URLs into FlashVars use &amp; rather than URL encoding (though I admit I do not know why because an ampersand is clearly there).

If you go that route, the result would look something like this:

<param NAME="FlashVars" VALUE="paramName=http://localhost/c/document_library/get_file?folderId=1&amp;name=DLFE-1.mp4">


If you're using a regular parameter rather than the FlashVars parameter (another potentially incorrect conclusion that I came to based on the information provided), then taking out the whole URL encoding should work.

<param NAME="paramName" VALUE="http://localhost/c/document_library/get_file?folderId=1&amp;name=DLFE-1.mp4">


If that doesn't work, I do remember a problem with some versions of Flash not using any of the cookie data stored in the browser (so it accesses everything as a guest user), as this was a problem with an older version of SWFUploader that we used for Liferay. However, this would have to be a situation where the video you are trying to view is protected by permissions.
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
Thanks for all the info! I ran into an SVN problem and had to deal with that before I could get back to this.

Yes, you are correct that I was using HttpUtil.encodeURL() on the whole thing. I think that was too much escaping so I took it out. I'm trying now just to give it a static URL that I manually enter until I can figure it out now. I've tried replacing the ampersands with &amp;, &#38; and %26. I think using %26 is actually working because with everything else I get this error:

16:08:56,062 WARN  [PortalImpl:3051] Current URL /c/document_library/get_file?p_l_id=10140 generates exception: No DLFileEntry exists with the key {folderId=0, name=}


When I use %26 I get no errors at all but the video still doesn't play. Is it possible that videos just can't be streamed from the Document Library?
3552992, modified 16 Years ago. Expert Posts: 301 Join Date: 7/13/09 Recent Posts
Okay so I guess it really is a problem with the player even though this same player works fine with these same files on the old site. I tried a different player in there and it worked no problem. Any idea why the old player wouldn't work in Liferay? I don't think it's a permissions issue because all this stuff is supposed to be viewable by the Guest user.
thumbnail
212638, modified 16 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Dave Willis:
Current URL /c/document_library/get_file?p_l_id=10140 generates exception

Ah, there we go. You included p_l_id as one of the parameters in the URL.

Perhaps contrary to expectations, that results in a VIEW permission check against whichever layout that p_l_id corresponds to. Assuming that you copy-pasted that URL from the control panel, then it's the layout corresponding to /group/control_panel, which guest users cannot access.

So the reason your player doesn't work is most likely a side-effect of your browser cookies not being passed inside of the Flash plugin. You could try switching back to your old player and removing the p_l_id parameter to see if it works.