today – VIDEO

Can’t put it off any longer! It’s time to get that video functionality in there. As usual, its research time…

Preliminary research indicates that i should use a flash movie player, which can be embedded into html. This looks promising: http://flowplayer.org/ .

Toyed with the idea of rigging something up to show this in a page somewhere but thought i might as well do all the setup properly, since it’s going to be largely the same as for pictures except for a) where thumbnails come from (not so easy to generate for movies!) and b) the mechanics of actually SHOWing the movie, ie what happens on the movies/show view page.

So – that’s all set up, with blanks for generating and showing thumbnails, and for showing the movie.

Downloaded an flv (of the great Richard Feynman) from youtube using this handy website that let’s you rip flv movies off sites: http://keepvid.com/ . Also downloaded a free flv player just so i could check i actually had a working flv movie. I do.

OK, testing it – something weird’s happened – the movie has been saved as an ‘octet-stream’ – ah, wait, i think i was using imagemagick to save the full sized picture, i’ve just copied that over to movies, no wonder. I’ll change the controller method to just copy and rename a file rather than a picture. Actually i moved that to the model, let’s have a look: the current code says this:

#save the movie to newspipe/data/movies with the name ‘mov#{self.id}.extension’
new_filename = “mov#{self.id}.#{self.content_type.split(“/”).last}”
File.open(“#{RAILS_ROOT}/public/data/movies/#{new_filename}”, “wb”) { |f| f.write(self.file_data) }

Hmmm – that’s not using imagemagick! It’s just using File.open.  I think i need another way of saving a file without opening it.

In the meantime, been trying to get flowplayer working with a saved flv file.   Tested it outside of rails, it’s having an issue with security:

flash security hassle with flowplayer

I’ve mucked about with the flash player settings, to no avail.

Ah wait, found it:  in the ‘global security settings’ panel, added the location “C:\code\useful stuff\flowplayer” (where i was testing it out) to the ‘allowed to access’ locations list.  So, i get to the movie player now but it doesn’t play properly – i just get a black screen in the player, and a stripy progress bar, whatever that means.

When i try it in newspipe, then i don’t get anything at all – not even the player.

There doesn’t seem to be anything about flowplayer in rails on the net.  Going to try a different line of enquiry for now.

OK, this looks promising:  another flash player, this time the JW FLV player.   Someone’s done a rails plugin for it here.  Here goes.  Ran this at the command line:

ruby script/plugin install svn://rubyforge.org/var/svn/flashplayrhelpr

nothing happened.  This looks like it might be a subversion (svn) – based plugin – maybe it’s time for me to install subversion finally.

2 responses to “today – VIDEO

  1. Well done, great blog and great posts!!!

  2. thanks!

Leave a reply to nubyonrails Cancel reply