[SOLVED] Random Video Module - Is This Possible?

Brat

Joined: 2003-08-03
Posts: 50
Posted: Sat, 2007-10-06 18:58

Greetings, all. I wasn't sure where this topic belongs, so my apologies if I've posted in the wrong area.

I'm working on a module (for Joomla) where I can randomly pull videos from G2 and allow members to play them (much like any of the 'tubes out there). I have the module where you can pull G2 thumbs, and I also have moseasymedia, which embeds players as a Joomla module. For this to work the way I want, I need to be able to randomly pull video (not the thumbnail) to play.

Is there a way to directly access uploaded videos? Due to security recommendations, my albums reside outside of the www directory (so that they aren't web accessible). Is there a way I can effectively bypass the thumb and go straight to the video?

Ultimately, I want the user to be able to play uploaded video without necessarily having to navigate to Gallery to do it.

Any and all ideas that point me in the right direction are appreciated. Thanks!

Regards,
Brat.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2007-10-06 21:01

Possible? Certainly!
Just fooling around a while back, I made G2ube (please view with firefox) but I never did finish it.
It uses html controls for the player - kinda cool.

Also the miniFLVplayer in the head of mysite loads and plays a random movie... So yes it certainly is possible.

-s
FlashYourWeb and Your Gallery

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Sun, 2007-10-07 01:07

I thought it should be possible! :-)

I have the actual embedding module for Joomla. What is the best method for pulling the actual video? Without compromising Gallery's security recommendations (meaning the main data directory is outside of web reach), could I, say, recursively search for files on the drive, construct the HTML link? I have some code, I was just wondering what was the best method to access the actual movie files. Thanks again!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2007-10-07 01:33

Take a look at the xml files included with my minislideshow.

-s
FlashYourWeb and Your Gallery

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Sun, 2007-10-07 20:15

Thanks for pointing me in the right direction! :-)

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Tue, 2007-10-09 07:26

I downloaded minislideshow (nice!) and looked at the XML files. The only problem is that I need URLs that are "real world accessible" by Joomla. That is, a URL in the form of http://www.mydomain.com/gallery2/main.php?g2_itemId=566 is not going to work when using something outside of gallery. What I need is a url in the format http://www.mydomain.com/gallery2/album/mymovie.mov. Basically, if I can get the XML to output URLs of that nature, I can then get the Joomla module to access the movie files. Where can I find information on how to rewrite the XML URL output in the desired format? Thanks again!

EDIT: Just to add clarity, I want to embed videos stored in G2 within external media players. YouTube generates a rewritten URL that works fine in the Joomla module. I just want to generate a G2 URL that similarly plays when embedded externally.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2007-10-09 10:50

http://www.mydomain.com/gallery2/main.php?g2_itemId=566 works externally, how do you think my media player(s) operate?
Joomla does not even enter the equation.

-s
FlashYourWeb and Your Gallery

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Tue, 2007-10-09 16:05

Okay, I'll give it another try. I probably just did something dumb. Hey, I'm new to all this video stuff. :-)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2007-10-09 21:01

you need to generate a url that flash(assuming you are using flash) can understand:

    global $gallery;
	$urlGenerator =& $gallery->getUrlGenerator();
    $theUrl = $urlGenerator->generateUrl(
	    array('view' => 'core.DownloadItem', 'itemId' => $item->getId(),
		    'serialNumber' => $item->getSerialNumber()),
		array('forceFullUrl' => true, 'forceSessionId' => true, 'htmlEntities' => true));
	return $theUrl;

so you need the proper view, full url, and especially htmlEntities.

my flash players use the <view> to display a video and the <thumbUrl> from my xml - oh and also height/width

also Kai has an easy way to use the minislideshow in joomla.

-s
FlashYourWeb and Your Gallery

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Wed, 2007-10-10 06:59

Thanks for the code suggestions. My implementation uses Flash, Quicktime, MP3... yep, quite a few media types.

Just out of curiosity, I turned on the URL Rewrite module. And, it generated a URL that plugs very nicely into all of the external media players (even flash).

The URL is in the format:

http://mywebsite.com/gallery2/main.php/d/605-1/a_quicktime_clip.mov?g2_GALLERYSID=4a45a9a891feb30586d0ae76859ba36c

I manually plugged this URL into simple embedded players and it worked flawlessly.

Basically, if I could generate a sort of XML playlist with these URLs, I could then just write a randomizer to pull a URL from that list. I have the XML-all file from the minislideshow working nicely. I just need at this point to find a way to have the XML file generate URLs in the desired format.

I'll keep plugging away at it with the code you gave. Once I have this working, I'll put together instructions on how to do this (hopefully it'll help someone else). Again, thank you for all your patience with a video noob.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2007-10-10 10:54

My xml files already take advantage of rewrite, just setup your rules as normal.

-s
FlashYourWeb and Your Gallery

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Wed, 2007-10-10 15:20

So, just to be sure I've finally gotten this right, if I take advantage of mod_rewrite (making the needed tweaks to my .htaccess file to add the proper rewrite rules), I should be done? Just want to be sure because, if so, my problems are now solved. Thanks!

 
Brat

Joined: 2003-08-03
Posts: 50
Posted: Thu, 2007-10-11 06:01

I worked with the XML file for a bit and was able to isolate the "playable" URLS. I took a copy of the minislideshow xml_all.php file and created a playlist.php file that generates player-friendly URLs. I'm still testing, but so far every link generated works flawlessly across all media players tested to date (Flash, Quicktime, MP3, IPod/MP4, etc.). Moseasymedia and G2 are now talking to each other. :-)

Though I am still tweaking, I am over the major hurdle, so consider this solved. Thank you again for all you patience and help.