General developer forum

Streaming video files from Amazon S3

 
Salad mandala
Streaming video files from Amazon S3
 

Hi,

Apologies if I'm being thick, but looking at the 2.0 release notes I notice that it says:

  • This allows Moodle to integrate with external repositories of content, making it really simple to bring documents and media into Moodle via an AJAX interface that looks like a standard Open dialogue in desktop applications.
  • Initial plugins in 2.0 include: Alfresco, Amazon S3, Box.net, File system on Server, Flickr, Google Docs, MERLOT, Picasa, Recent Files, WebDAV servers, Wikimedia, Youtube. These are simple to develop, so many more are expected.

It would be ideal for me to store streamed videos of content, but having looked some more I can't find any more details of how to practically do this. Has anyone successfully set this up and be willing to share how it's done please?

Thanks in anticipation.

David

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi David,

In Moodle 1.9, I've successfully accessed video files stored on an AWS S3 bucket server account. The most likely issues to cause problems are having a correctly configured crossdomain.xml file* at the bucket server root and any user access authentication that you might want to implement. If you don't want to implement user authentication, then it would be much cheaper to simply upload video files to a free video hosting service such as YouTube.com, mark them as unlisted so that 3rd parties can't find them easily (unless you want them to) and access them from there (See demo here: http://matbury.com/moodle/mod/mplayer/view.php?id=628). Moodle uses an old version of the JW FLV Player. The newer one that I use with the Media Player module (http://code.google.com/p/moodle-mplayer/) includes a special plugin for streaming YouTube.com videos (http://www.longtailvideo.com/)

* See Flash Player security model (http://www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html). IMPORTANT! - Do not use a proxy script to bypass the crossdomain.xml file requirement. It's there for a reason!

I hope this helps! smile

 
Average of ratings: -
Salad mandala
Re: Streaming video files from Amazon S3
 

Thanks very much Matt, that's a great help to start me off...

 
Average of ratings: -
Salad mandala
Re: Streaming video files from Amazon S3
 
Hi Matt,
So if I wish to play back mp4, flv, mp3 etc. securely via Amazon S3, do either of your media players stop un-authorised people from linking directly to your S3 links like this?
Of course, when they have logged out of Moodle they will not be viewing
the video players, but how do I avoid hotlinking to the S3 bucket links?
Thanks!
 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi David,

The idea would be to protect the media files where they are, i.e. put a lock on the bucket server, and give users keys to open it. Keys can be general (all users to all files) or very specific (individual users to individual files on a case by case basis) and everything in between, a bit like modern credit card style hotel keys.

Firstly, you'd have to create a user authentication gateway (lock) at the bucket. AWS provides a lot of developer resources, documentation, tutorials and examples to help with this at their end. At the Moodle end, you'd also have to develop a system that manages user access keys so that they can be authenticated automatically when they access the media files.

The Media Player and SWF Activity modules (the Media Player module is actually a branch of the SWF Activity Module) could be easily adapted to do this.

 
Average of ratings: -
Salad mandala
Re: Streaming video files from Amazon S3
 

Hi Matt,

That sounds very promising. So if I just want to display a private, Amazon S3 secured, mp4 video, could you give an example of how to adapt your plugins to do this please.

I am fine setting up permissions etc. in Amazon S3 but not familiar with your plugins, so I just have to understand your piece of the jigsaw.

This is the bit that I am not sure about:
"At the Moodle end, you'd also have to develop a system that manages user access keys so that they can be authenticated automatically when they access the media files."

And you say that they (your plugins) can easily be adapted to do this. But I would really appreciate if you could give me an actual example please.

Thanks for all your help.

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

It really depends on so many things and it may be different for other bucket servers. That's why I didn't include this feature in the modules. I'd recommend contacting a developer and working out the exact specifications you'd like and going from there.

 
Average of ratings: -
Picture of Andrew D
Re: Streaming video files from Amazon S3
 

Hi David

I am looking to do the same thing here.  I assumed (poss foolishly) that if I used the Amazon S3 repositories feature in Moodle I would then be able to play files simply by using "add a resource / file" and let the built in media filters do the rest. Whilst I can see my S3 buckets and files this way and add them to the course, none of them will actually open from within the course (I tried .mov, ,flv and even .pdf but none opened that way).

I am guessing this is because the Media Filters functionality in Moodle 2 isn't aware of the S3 repository settings so can't access the files, although even when I make them available to everybody it still fails.  I posted a new question about it here (before spotting this thread) detailing what works and doesn't in my case, so might be worth keeping one eye on that too: http://moodle.org/mod/forum/discuss.php?d=166149

Best Regards

Andy

 
Average of ratings: -
Salad mandala
Re: Streaming video files from Amazon S3
 

OK, thanks Matt & Andy, much appreciated... Let's hope this can be easily achievable in the near future.

 
Average of ratings: -
Picture of Andrew D
Re: Streaming video files from Amazon S3
 

I believe we have just spotted what's causing our problem. If we put a file into a bucket on Amazon (a pdf file for now) it shows up fine, if we put it into a folder within the bucket it doesn't work at all.

When we edit/update the file within the course, moodle seems to be blending the folder name and file name into the file name., so any files we put into folders within buckets aren't working (we didn't spot it sooner as we had no files in the root of the buckets)

For example file.pdf in the root of the bucket works fine and displays through moodle.

"file.pdf" put within "Folder1" within a bucket shows up in moodle as as being a file called "Folder1file.pdf"

Anybody else getting this or have I been looking at this screen too long?

Andy

 
Average of ratings: -
Salad mandala
Re: Streaming video files from Amazon S3
 

OK, that could help... keep us informed (I'm distracted with another big job at the moment).

Thanks!

 
Average of ratings: -
Picture of Bruno Lima
Re: Streaming video files from Amazon S3
 

Hi David,

I was struggling about it too. If you use progressive download technique it is impossible avoid the user download the content since they already have this content in their browser cache. You can make it harder by using signed URL´s with expiration date and signature based on private keys (I´m using this with Amazon CloudFront).

If you are using HTML5 video players it´s very easy to download the content, a simple right click and Save Video As in the context menu, you could go with flash based players but as we all know these are in a slow death process.

By the way, I´m using videojs (videojs.com) to embed CloudFront mp4 videos since CloudFront now supports HLS streaming.

 
Average of ratings: -
Picture of Quang Kim
Re: Streaming video files from Amazon S3
 

Hi Matt, 

I used Moodle 2.2. I have a video streaming server is used to Red5. I want to use this server to play the video on moodle.

In moodle 1.9, i found WebClass plugin for streaming video on Moodle from red5 server. But moodle 2.2, I have not found any solution?

How to use streaming video in moodle 2.2?

 
Average of ratings: -
Picture of Tulio Velásquez
Re: Streaming video files from Amazon S3
Particularly helpful Moodlers



why not use google drive?, when uploading a video on google drive, allows you to generate code for insertion



 
Average of ratings: -
Picture of Russell Raymer
Re: Streaming video files from Amazon S3
 

We use Amazon S3 to host all our videos which are in .flv format.  We are posting full hour to hour and a half videos of each lesson so the S3 is prefered to using another hosting. I love the fact that I can send a hard drive to Amazon to upload several 100 GB at a time and not have to try to upload each lesson on our interent connection. We use the Add URL and place the S3 url address for the video in. This allows the video to play inside Moodle using the flash playing included in moodle. You must have the setting on your S3 files so that everyone can read-download so that it will play. There is the chance that someone could find the link and download the file, so it is not perfectly secure, but having it in .flv makes it a little more difficult.

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi,

If anyone is trying to use Amazon cloudfront rtmp and the strobe player in the swf module, you can access your videos this way:

create a standard bucket (not website) and set acl permissions to only you.

Add your video and set acl permissions to public read only.


In the swf module settings: go to the 'Video, Flash Content, and Playlists' area add the following:

rtmp://<cloudfront url>/cfx/st/_definst_/mp4:<yourVideo>.mp4

subsitute <cloudfront url> with your cloudfront url

substitute <yourVideo> with your video name

I tried using signed urls but came up with an error writing to the database. I am guessing that because the signature contains '&' in it, this caused the error.

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 
Hi, I have managed to add the signed url by changing the field type of 'videourl', in the moodle table 'mdl_swf', from varchar(255) to text. The '&' was not causing a problem but the signed url is longer than 255 characters. I haven't managed to view the video with the signed url, but it's a start.
 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Thanks for the feedback Robert. Out of interest, how long are the URLs you're using? e.g. Do they contain public keys?

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 
Hi Matt, This is using cloudfront. I had 381 characters in one signed url. They have a 'Policy', a 'signature', and a 'Key-Pair-Id' (these are all hashed). I have temporarily given up on the signed urls. I think the player needs to reside with the videos in an S3 bucket. As far as I can makeout the link to the player is a signed url from the origin access ID and the videos are public, though the bucket is not. The only benefit I can see in the signed url is the expiry date. Someone can still copy the signed url and view the videos. Hotlinking is also a problem with cloudfront. I can set up a policy on a bucket which will only allow my website to access it. Once I use cloudfront, that policy doesn't work. You can use IP addresses with cloudfront, in this way, but I use a shared server which does not offer personal ip addresses. The main reason I am using cloudfront as it offers streaming videos rtmp. The method that I placed in my first post works, but that does not contain signed urls. As this one works then there cannot be a problem with cross domain policies.
 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi Matt,
I finally found the solution to using signed urls. The signing must only be on the file not the cloudfront url and file. I used this file from amazonnaws docs (note: this is a download link) http://awsdocs.s3.amazonaws.com/CF/latest/demo.php to create the signed part of url for the video only. This gave me <my video>%3FExpires%.... etc.. I just added that to rtmp://<my cloudfront>.cloudfront.net/cfx/st/_definst_/mp4:

Url= rtmp://<my cloudfront>.cloudfront.net/cfx/st/_definst_/mp4:<my video>%3FExpires%.... etc

I found the demo.php gave some errors the variable path was not defined so I just did this:

function create_stream_name($stream, $policy, $signature, $key_pair_id, $expires) {
    $result = $stream;
    // if the stream already contains query parameters, attach the new query parameters to the end
    // otherwise, add the query parameters
    $path= "";

They use an older method of calling swfobject so I by-passed the nonsense and just added(with the php tags) echo ($canned_policy_stream_name); and echo ($custom_policy_stream_name); above the closing body tag.

If anyone has any problems with this please let me know.

Cheers

Rob

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi Matt,

I have been trying to using an xml playlist for the strobe player. I followed the instructions and created a folder in repository/swf/content within the moodledata folder. I then created a namespace folder and an xml folder within that.

The xml file that I used within the xml folder looks like this:

<?xml version="1.0" encoding="utf-8"?>
<smil>
  <head>
  </head>
  <body>
      <seq>
<video title="First mp4 video" src="rtmp://<my cloudfront domain>.cloudfront.net/cfx/st/_definst_/mp4:<my mp4>.mp4"/>
                </seq>
        </body>
</smil>

The link I used in the Video, Flash content, and playlists was

http://<my domain>/video_training_courses/mod/swf/content.php/content/<my name space>/xml/test_xml.xml

But my video will not play.

The link to the xml file is correct, as I can access it.

Have you tried playlists with the strobe player in the swf module? If so can you see where I am going wrong?

Thanks in advance


 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Robert,

For playlists, the Strobe player can use M3U files. They're much simpler and easier to edit and manage than SMIL.

Here's a demo: http://matbury.com/strobe/StrobeMediaPlayback.html?src=playlists/playlist.m3u

And here's a direct link to that playlist: http://matbury.com/strobe/playlists/playlist.m3u

I hope this helps!

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi Matt,

Thank you for you quick response and demos. I notice, or it appears, that they are not using the swf module. 

If this is the case then where is the m3u stored, in the course folder? I am guessing you would link the the strobeplayer.swf located in moodle.

Cheers

Rob

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Robert,

If they're not using /moodledata/repository/etc. then I'd guess they're more than likely uploading the M3U/SMIL file via Moodle's file manager, or putting it in a publicly accessible directory on the server, or on an AWS S3 bucket server (with the videos?).

In the case of a bucket server or directory on another domain, as long as there's a correctly configured crossdomain.xml policy file on it and the URLs in the M3U file are absolute with the correct variables, etc. it should work.

AFAIK, most of the popular Flash media players, e.g. Strobe, JW Player, and FlowPlayer (Moodle's default media player) support a variety of playlist formats, including M3U.

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi Matt,
Thanks for the response.
I will try a few different set ups and get back to you.
You are right about the m3us being easier than xml, to create.
Did you see my post about getting the signed urls to work? I still needed to change the videourl field to text in the database due to the length. It might be an idea, for future udgrades for the swf module, to apply this setting, what do you think? I am sure others will use it for S3 and cloudfront, but may not see why they can't save the url.
Thanks again
Rob

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Robert,

Re: "I still needed to change the videourl field to text in the database due to the length. It might be an idea, for future udgrades for the swf module, to apply this setting, what do you think? I am sure others will use it for S3 and cloudfront, but may not see why they can't save the url." -- Yes, it'll be done on the next upgrade.

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Robert,

I've updated it with the new videourl text definition. The new version is now available on both the Github and Moodle.org plugins repositories.

You'll have to uninstall the old version and reinstall the new one. The maturity of the project is now stable so future upgrades won't involve uninstallation and therefore maintain all instances throughout Moodle.

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi Matt,

That's great. Thanks for that. I have been setting up an EC2 instance with moodle on Amazon. I needed to setup phpmyadmin to edit the videourl. I had only just finished doing this when I saw your post. That will make life alot easier.

Cheers and thanks

Rob

 
Average of ratings: -
Picture of Robert Archibald
Re: Streaming video files from Amazon S3
 

Hi Matt,

I tried using a M3U file as a playlist in the swf module /moodledata/repository/ but it doesn't utilize the strobe player, it just comes out as an mp4. I was using cloudfront urls and havent tried it with local files.

I am not really in need of this functionality but it may be something that could be looked at.

Thanks

Rob

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Robert, did you select the Strobe Player?

 
Average of ratings: -
Picture of Samuel Than
Re: Streaming video files from Amazon S3
 

For those using Amazon S3 to stream videos, does it tax your local server's upload/download bandwidth ? 


 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Samuel,

No, it doesn't. That's the point of using a content distribution network (CDN). The files/media should come directly from the CDN, thereby substantially reducing the load on the server where the app (in this case Moodle) is running.

However, AFAIK, you should be careful when Moodle's file manager, e.g. using S3 as an external repository, as it may end up serving files via the Moodle server and use up bandwidth and a lot of memory (Moodle's file manager serve's files and media via PHP which loads the files into the CPU's memory very inefficiently).

Just a small point, S3 isn't a "streaming server" and so video and audio files aren't streamed, they're simply downloaded into your browser's cache while they're being played back.

I hope this helps! smile

 
Average of ratings: -
Picture of Samuel Than
Re: Streaming video files from Amazon S3
 

Oh.... hm...  That may explain why my server's upload and download bandwidth is chewed up when i'm attempting to serve up videos for viewing and downloading.

So, i'm getting the idea that the custom php code i'm using should not be serving files via the Moodle server, is that correct ?





 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Samuel, yes, if you see .php anywhere in the URL to the video file(s), then it's going to fill up your server's memory and use bandwidth unnecessarily.

 
Average of ratings: -
Picture of Samuel Than
Re: Streaming video files from Amazon S3
 

I echoing the playback from a php to a script.

Are they any suggested alternatives ?   If you don't mind shading some lights.

I've included a sample view.php file


Any help would be greatly appreciated.





 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Samuel,

The thing to do is to avoid using PHP to serve the video files altogether (It's not what PHP is good at doing). Straight Apache HTTP(S) calls are preferable. Is there any way you can have the media player load the video files directly from S3? e.g. src="h t t p : //mybucket.aws.com/media/video/file.mp4"

Another option is to use an actual CDN service with all the tools you'll need for authentication and integration. The thing is to work out how much of a load you expect playing back video via Moodle is going to be and if it's more or less cost effective to use a CDN or to script your own solution on AWS + Moodle.

 
Average of ratings: -
Picture of Samuel Than
Re: Streaming video files from Amazon S3
 

Hi Matt,

     Thank for taking your time to explain.  Can you elaborate "straight Apache HTTP(S) calls", i'm somewhat limited in understanding this portion ?


"Have the media player load videos" Did you mean adding a page actvity and add media ?


I was actually using Cloudfront + S3 in attempt to serve up videos, i guess it's the way i'm loading it in Moodle that's not efficient.

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Samuel,

When the URL of your video file looks something like h t t p : // example.com/file.php/123456/path/to/video.mp4, here's what's happening:

  1. The server executes the PHP script at h t t p : // example.com/file.php
  2. h t t p : // example.com/file.php takes the "/123456/path/to/video.mp4" bit and adds on the path to where the moodledata directory is on the server, usually something like "/home/owner/moodledata", making it the path "/home/owner/moodledata/123456/path/to/video.mp4"
  3. PHP then loads the file video.mp4 into the server's memory and starts sending the video (via progressive download, not "streaming") to the user.

In this scenario, you're using Apache as the server and PHP (Apache + PHP) as a "proxy" to fetch the video file from a directory on the server that isn't directly accessible/visible to the public, i.e. the path "/home/owner/moodledata/123456/path/to/video.mp4" is restricted and you need it to be routed via "h t t p : // example.com/file.php". "file.php" also runs Moodle (Apache + PHP + Moodle) to verify whether the user requesting the video has permission to view it, which in turn uses up more server memory and resources.

If the video file is in a directory like "/home/owner/public_html/files/media/video/myvideo.mp4" then a call to the server at "h t t p : // example.com/files/media/video/myvideo.mp4" will use Apache alone to serve the video, which is much more efficient than Apache + PHP + Moodle. The downside is that anyone who knows the URL "h t t p : // example.com/files/media/video/myvideo.mp4" can also view/download the video without being logged in to Moodle.

If you use a CDN (e.g. AWS), they will have a way to exchange tokens (for verifying that the user has permission) between the media player on your Moodle and the CDN server. If you use a streaming server (usually Java + Red5 or Flash Media Server, and there are hundreds of 3rd party CDN providers for this to choose from), users can view the video starting at any point by dragging the playback bar ("scrubber" or "playhead") to the point they want to view, e.g. YouTube uses Flash Media Server and you can drag the playback bar to the end of very long videos and they'll start playing at that point immediately. With progressive download, users have to wait for the video to download into their browser's cache to that point. However, streaming media servers have issues with stability when internet connections are slow or intermittent. Progressive download is more stable and so has an advantage in this respect. (Actually, YouTube uses a kind of hybrid streaming server + progressive download to serve video files in chunks for more stability).

Perhaps Cloudfront could help you with user authentication if restricting who has access to the videos is important. Of course, the easiest and cheapest way to serve video (usually free) is to upload it to a public service like YouTube or Vimeo and copy and paste their embed codes into Moodle pages.

I hope this makes sense.

 
Average of ratings: Useful (1)
Picture of Doug Moody
Re: Streaming video files from Amazon S3
 

Matt,

Thanks for the thorough explanation of this process.

I have been streaming video to my students for years, and until last year, I used a Moodle plugin called Poodl. This plugin is very good at what it does in Moodle. Basically, it is a frontend interface for managing the difficult task of which players ought to be used for playing back and recording video and audio. It makes all those tasks kind of invisible so you can get to the main task.

Anyway, I was storing all my videos in moodledata, so the streaming was coming from there. It was true streaming, but it put a high load on the server doing what Matt showed us above.

I investigated other ways, and finally decided to put my videos on Google Drive. I then got the embed code from Google (that's a different story, but once you know how its simple) and put that code in the html portion of the web page resource I created for each student lesson.

The reason I decided on Google drive was because it is a true streaming server for video. I briefly thought about Microsoft OneDrive, but it turns out it doesn't really stream, it progressively downloads. There might be other good streaming servers, but Google operates a great server farm, so downtime is minimal. 

Speaking of progressive downloads...Matt, do you know what happens to the data that gets progressively downloaded locally? Is it saved on the hard drive or into RAM memory? If hard drive, how does it get purged? I have always wondered about that.

Anyway, Google Drive allows different ways for those requesting the videos to view them. One way makes the video public, so anyone can discover them. Another way is that the videos can be watched by anyone with the link. That's what I chose. A third option would be anyone with a password can view them, but I didn't choose that because I figured that since those with the link are already authenticated as my students, there didn't need to be another layer of security.  On that note, Moodle doesn't allow someone to right click on the link and download a private copy, so I am protected there also.

 
Average of ratings: -
Picture of Ken Task
Re: Streaming video files from Amazon S3
Particularly helpful Moodlers

"I then got the embed code from Google (that's a different story, but once you know how its simple)"

Ok ... tell us the 'different story' and inform as to how (simple).   Curious minds want to know! ;)

In my neck of the woods there are many schools that have 'gone Google' (even more to follow with the coming of Google Classroom now available).

'spirit of sharing', Ken

 
Average of ratings: -
Picture of Doug Moody
Re: Streaming video files from Amazon S3
 

Ken,

I had to discover this myself. I looked on the web, but couldn't find out how to do it, but then stumbled on the correct way.

When you are in Google Drive, you hover over the icon of the file you have put there.

Then right click and choose "Open with Google Drive Viewer"

At the top of the page that opens you will see three vertical dots. Left click and choose "Embed Item" There will be a box with the necessary embed code in it. Copy that code to memory.

Then, go to the page where you want to embed the code and insert it into the html coding where you want the video to appear and play.

Another feature I discovered is that if  you want a particular still image to represent the video, play forward to that frame in Google before you ask for the embed code. Google embeds the still in the video preview of that file. 

Does that help?

 
Average of ratings: -
Picture of Ken Task
Re: Streaming video files from Amazon S3
Particularly helpful Moodlers

Thanks!   Have tried that following your directions, but not working for me ... seems I associated a .mov file with a conversion app.   My options don't include showing the embed code.   Of course, it could also be that I've managed to get a hold of a protected video some how (Cat Can't Print).

Will try another video ... one that I create and see.

Been looking for a way to do this ... and this would be a VERY BIG plus for schools that have 'gone google'. ;)

Thanks, again, Ken

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Ken,

I tried it too. I managed to get the embed code:

<iframe src="https://docs.google.com/file/d/0B9cnHwPB8YFBR1JyY3BPWE00Y2c/preview" width="640" height="480"></iframe>

but this just creates an empty iframe. I have the viewing permissions set to public and I've tested that the link works in other browsers that aren't logged into Google.

When I try feeding the URL into the Strobe and JW Players, I get errors. The URL on its own returns an HTML page with the YouTube player embedded.

Also tried the embed code in a Wordpress.com blog (so the Jetpack filters should convert the iframe into shortcode):

[googleapps domain="docs" dir="file/d/0B9cnHwPB8YFBR1JyY3BPWE00Y2c/preview" query="" width="640" height="480" /]

Still got an empty frame.

So something's preventing this video from playing... puzzling.

 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Doug,

Re: "Speaking of progressive downloads...Matt, do you know what happens to the data that gets progressively downloaded locally? Is it saved on the hard drive or into RAM memory? If hard drive, how does it get purged? I have always wondered about that." -- The video files are stored in the browser cache, i.e. in a security sandbox on the computer's hard drive. If your browser gets slow, laggy, unresponsive, it's sometimes because the browser is reaching or at its cache limit (I think some browsers now manage cache storage limits automatically, but I don't know). Purging the cache can fix this and then you have re-login to all your online accounts. This doesn't delete stored IDs and passwords, so password auto-complete for those websites will still work.

Re: Google Drive, yes, there are lots of ways to find "free" media hosting each with its pros and cons. Another way is to upload video to YouTube and select the option to hide it from public listings and search results. That way only people who know the URL can find it.

Video is always susceptible to download/recording/grabbing the files from the browser cache even if they're streamed, it's just a matter of how far you're willing to go to make it more difficult for users to do (There are so many apps and extensions for "grabbing" protected video off the web!). Conversely, the more difficult you make it to download/record, the more likely it will be for users to encounter problems during "normal" playback on their devices. This is one of the things that has driven large numbers of viewers of films and TV shows to watching pirated media - it's just easier, more convenient, and less problematic. Our task should be to make user experiences as easy, convenient, and unproblematic as possible so as to not incentivise copying and redistribution.

 
Average of ratings: -
Picture of Doug Moody
Re: Streaming video files from Amazon S3
 

Matt,

Google drive also lets you hide the file you are serving multiple ways. I sipmly make my files only viewable if the user has the code. There is a setting in Google drive where you can protect a single file this way or an entire folder.

The main reason I use Google instead of Youtube is that my school has turned off student access to Youtube. Even a special Youtube code wouldn't be able to get through their firewall. I checked with the IT people beforfe I decided to use Google and they said they had no plans to block it.

 
Average of ratings: -
Picture of Samuel Than
Re: Streaming video files from Amazon S3
 

Thanks Matt  for the great explanation. You've clarify quite alot of things for me now smile  THumbs Up !!

I've been doing abit of read up too since your post,  get me thinking about sending files via php + apache and ways to overcome it.... come across something called X-sendfile ..for those interested. 

http://stackoverflow.com/questions/3697748/fastest-way-to-serve-a-file-using-php

http://benrowe.info/index.php?r=site/item&type=article&slug=how-to-use-x-sendfile-in-php

Seems to have the potential of not taxing the memory, however bandwidth is still taxing /problematic

http://stackoverflow.com/questions/6024951/using-up-bandwidth-when-calling-readfile-on-a-different-server


Anyway, i gather the best way forward for now is to have a generated embed code insert into the html editor of Moodle..

I began doing some research on have 3rd party video hosting service, rather then going at it solo with s3 as i'm more concern about mitigating the bandwidth consumption from our server.


Wistia.com seems promising as we're really liking the analytics element... tracking how effective a video is...




 
Average of ratings: -
Matt Bury
Re: Streaming video files from Amazon S3
Particularly helpful MoodlersPlugin developers

Hi Samuel,

Great stuff! Thanks for sharing. Good ol' Stack Overflow smile

If you're going for the X-Sendfile option and if possible, setting it up in apache config is more efficient than using .htaccess files.

To save you some time with the Moodle part of it, here's the script I use for serving files and Flash apps in the SWF Activity Module: https://github.com/matbury/SWF-Activity-Module2.5/blob/master/swf/content.php It'd be relatively easy to hand over serving the file to Apache X-Sendfile once it's performed the user/login checks.

Good luck and please let us know how you get on. smile

 
Average of ratings: -