Keyword

Remote Preview Image

More
14 years 1 month ago - 14 years 1 month ago #15991 by ljk
Replied by ljk on topic Re: Remote Preview Image
Hi,

I have found that the plugin is not using flv but flvremote even when the video is on your website. So, to get the preview image to display I have made the following changes to the plugin version 3.3.

Backup the two files below, before you make the changes so you can fall back to a working copy if anything goes wrong.

In /plugins/content/jw_allvideos.php:
Around line 162 you will find this code:
	$tagcontent 	= preg_replace("/{.+?}/", "", $match);
	$tagparams 		= explode('|',$tagcontent);
	$tagsource 		= trim(strip_tags($tagparams[0]));
	$final_vwidth 	= (@$tagparams[1]) ? $tagparams[1] : $vwidth;

Change it to:
	$tagcontent 	= preg_replace("/{.+?}/", "", $match);
	$tagparams 		= explode('|',$tagcontent);
	$tagsource 		= trim(strip_tags($tagparams[0]));
					
	/* Hack to display the preview image for flvrremote type videos */
	if ($plg_tag == 'flvremote') {
		// Need to get the filename, without the extension so we can make the image filename
		$imagefile = substr($tagsource, 0, strrpos($tagsource,'.'));
	} else {
		$imagefile = '';
	}
	/* End hack */
					
	$final_vwidth 	= (@$tagparams[1]) ? $tagparams[1] : $vwidth;

Find this code:
					// source elements
					$findAVparams = array(
						"{SOURCE}",
						"{SOURCEID}",
						"{FOLDER}",
						"{WIDTH}",
						"{HEIGHT}",		
						"{AUTOPLAY}",
						"{TRANSPARENCY}",
						"{BACKGROUND}",
						"{BACKGROUNDQT}",
						"{CONTROLBAR}",
						"{SITEURL}",
					);

Replace it with this code:
					// source elements
					$findAVparams = array(
						"{SOURCE}",
						"{SOURCEID}",
						"{FOLDER}",
						"{WIDTH}",
						"{HEIGHT}",		
						"{AUTOPLAY}",
						"{TRANSPARENCY}",
						"{BACKGROUND}",
						"{BACKGROUNDQT}",
						"{CONTROLBAR}",
						"{SITEURL}",
						"{IMAGEURL}", // Add image url to parameters list
					);

Find this code:
					// replacement elements
					if(in_array($plg_tag, array("mp3","mp3remote","wma","wmaremote"))){
					
						$replaceAVparams = array(
							$tagsource,
							substr(md5($tagsource),1,8),
							$afolder,
							$awidth,
							$aheight,
							$final_autoplay,
							$transparency,
							$background,
							$backgroundQT,
							$controlBarLocation,
							$siteUrl,
						);
						
						$output->playerWidth = $awidth;
						$output->playerHeight = $aheight;
						
					} else {
					
						$replaceAVparams = array(
							$tagsource,
							substr(md5($tagsource),1,8),
							$vfolder,
							$final_vwidth,
							$final_vheight,
							$final_autoplay,
							$transparency,
							$background,
							$backgroundQT,
							$controlBarLocation,
							$siteUrl,
						);

Replace it with this code:
					// replacement elements
					if(in_array($plg_tag, array("mp3","mp3remote","wma","wmaremote"))){
					
						$replaceAVparams = array(
							$tagsource,
							substr(md5($tagsource),1,8),
							$afolder,
							$awidth,
							$aheight,
							$final_autoplay,
							$transparency,
							$background,
							$backgroundQT,
							$controlBarLocation,
							$siteUrl,
							$imagefile,  // Add image url to parameters list
						);
						
						$output->playerWidth = $awidth;
						$output->playerHeight = $aheight;
						
					} else {
					
						$replaceAVparams = array(
							$tagsource,
							substr(md5($tagsource),1,8),
							$vfolder,
							$final_vwidth,
							$final_vheight,
							$final_autoplay,
							$transparency,
							$background,
							$backgroundQT,
							$controlBarLocation,
							$siteUrl,
							$imagefile,  // Add image url to parameters list
						);

Finally in /plugins/content/jw_allvideos/includes/sources.php on line 39 in the flvremote section replace:
	<param name=\"flashvars\" value=\"file={SOURCE}&autostart={AUTOPLAY}{CONTROLBAR}&fullscreen=true\" />

with:
	<param name=\"flashvars\" value=\"file={SOURCE}&image={IMAGEURL}.jpg&autostart={AUTOPLAY}{CONTROLBAR}&fullscreen=true\" />

Making these changes should now give you a preview images as long as you have the image in the same folder as your flv file and you name the image file the same as the flv file, but with a .jpg extension. If you wanted a different extension on your image file change it in the line above (.jpg for .png, if you wanted png images instead).

To get the image to display properly in K2 you need to add the following hack to remove the beginning / from the video path:

/administrator/components/com_k2/views/item/tmpl/fielbrowser.php line 42 remove the beginning / from the <a href="
                    <a href="/<?php echo $this->path.'/'.$file;?>" class="<?php echo $this->type;?>File">
                        <img width="64" alt="<?php echo $file;?>" src="<?php echo ($this->type=='video')? JURI::root().'administrator/components/com_k2/images/system/video.png':JURI::root().$this->path.'/'.$file;?>">

becomes:
                    <a href="<?php echo $this->path.'/'.$file;?>" class="<?php echo $this->type;?>File">
                        <img width="64" alt="<?php echo $file;?>" src="<?php echo ($this->type=='video')? JURI::root().'administrator/components/com_k2/images/system/video.png':JURI::root().$this->path.'/'.$file;?>">


I hope this helps others get their preview image for flv files.

Good luck.

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #15992 by ljk
Replied by ljk on topic Re: Remote Preview Image
Hi,

See the previous post. You have to hack the code to get the preview image to work for flvremote. The preview image needs to be named the same as your flv file except with a .jpg extension.

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #15993 by trigrano
Replied by trigrano on topic Re: Remote Preview Image
Hi,

is the code-hacking solution still the way to go for remote previews in version 4.0 or is there an easier way?

Just adding {flvremote}http://flashvideo.flv&image=http://flashvideo.jpg{/flvremote}

doesn't work...

THX

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #15994 by ljk
Replied by ljk on topic Re: Remote Preview Image
Hi all,

I am afraid that we still need to make some hacks with AllVideo plugin 4.x. Here are the hacks needed for 4.1:

In /plugins/content/jw_allvideos.php  around line 222 you will find the following code:
					} else {
						$output->posterFrame = '';
					}

replace it with:
					} else {
                   
						/* Hack to display the preview image for flvrremote type videos */
						if ($plg_tag == 'flvremote') {
								// Need to get the filename, without the extension so we can make the image filename
								$output->posterFrame = substr($tagsource, 0, strrpos($tagsource,'.')) . '.jpg';
						} else {
								$output->posterFrame = '';
						}
						/* End hack */
						// $output->posterFrame = '';
					}

In  /plugins/content/jw_allvideos/includes/sources.php around line 41 you will find this code:
$mediaplayerEmbedRemote = "
<div id=\"avID_{SOURCEID}\" style=\"width:{WIDTH}px;height:{HEIGHT}px;\" title=\"JoomlaWorks allvideos player\"></div>
<script type=\"text/javascript\">
	jwplayer('avID_{SOURCEID}').setup({
		'file': '{SOURCE}',
		'height': '{HEIGHT}',
		'width': '{WIDTH}',

replace it with this code:
$mediaplayerEmbedRemote = "
<div id=\"avID_{SOURCEID}\" style=\"width:{WIDTH}px;height:{HEIGHT}px;\" title=\"JoomlaWorks allvideos player\"></div>
<script type=\"text/javascript\">
	jwplayer('avID_{SOURCEID}').setup({
		'file': '{SOURCE}',
		'image': '{PLAYER_POSTER_FRAME}',
		'height': '{HEIGHT}',
		'width': '{WIDTH}',

With those 2 modification a preview image that is stored in the same folder as the flv file with the same filename.jpg will be shown.

You will still need to do the fix to /administrator/components/com_k2/views/item/tmpl/fielbrowser.php documented above. Note that this fix was for version 2.4.1 of K2.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum