Rails stream audio mp3 from S3 - ruby-on-rails

I'm building an app that has mp3 files stored on Amazon S3, and want to allow users to listen to the audio files from their browsers.
The original plan was to use the html5 audio tag, but since that won't work in older browsers, an alternative is needed.
I've never worked with streaming audio before, and don't know what is needed to get started. Do I need to use an outside player to do this? Can it be done in html? Javascript? What is the best way to approach this?
Thanks!

You can use HTML5 as the main solution and fall back to javascript or flash if it is not supported. Something like this might work well: http://jplayer.org/

Related

Uploading a video to youtube from my swift app

I've been asked to integrate videos into an existing app which previously only let users upload posts with images.
I don't want to host the videos on my own server for the following reasons:
Server Bandwidth
File Size Limits and Storage Space
Slow-Loading Video or Unexpected Pauses During Playback
Issues with converting to specific formats
Piracy
Based off this article:
https://www.wp101.com/10-reasons-why-you-should-never-host-your-own-videos/
So I tried to research into where I could host the files and then I would simply have to store the URL in my db and use a video player to stream the content.
Vimeo and youtube seemed to be the main options I could find.
I'm wondering how best to implement, would I make use of a youtube API and on successful upload, grab the link and upload to my own server? I'm concerned this may be a long process for the end user.
Another problem is I can't see any swift examples (ZERO obj-c experience) of making the http request but perhaps it is still possible but I'd just have to write the code myself? I'm wondering if anyone has implemented anything like this already as I can't find any examples.
Looking at this question:
How do I upload a video to YouTube from within an iOS application?
None of the links in the comments work and the answer directs to the youtube 2.0 API and I'm concerned that this is now deprecated.
Any advice appreciated!

How to get video download link from youtube?

I searched far and wide and came up with nothing.
Ok, that is not completely true, there are in fact tons of solutions on the Internet (even here on stackoverflow) on how to get a download link for youtube video, but not a single one of them is working anymore, since youtube seems keep changing things all the time.
What I want to do, is to write a PHP script which will be able to download video from specified youtube page and then save it on the server in flv or mp4 format.
I can get some video information by downloading this: http://www.youtube.com/get_video_info?&video_id=VIDEO_ID
But thats about it, no matter what I do, I just cannot figure out how find the link pointing to the video download.
I tried to use this link: http://youtube.com/get_video?video_id=VIDEO_ID&t=TOKEN&fmt=18&asv=2 from one more recent solution I found, but either there is something missing in it, or it's completely outdated already too.
So how can I dig out some working link for direct video download from youtube?
There has to be some way to do it, since there are some web pages out there which provide this service.
Thank you for any advices.
I prefer RealPlayer to download videos from youtube and other video sharing sites like metacafe, funnyordie and others. You're able to download in both mp4 or flv format, save them, and view them whenever you'd like.. even if you're not online which is great for travel. http://www.real.com/realdownloader

Creating a Rails Music Player App (something like Rdio)

i want to create a rails app that has a lot of mixtapes, which the user can listen to and download (like datpiff.com). All the mixtapes would be uploaded by me. Each mixtape would have their own page, with the title, artist name, cover, etc.
I'm having trouble getting the architecture of the app right. What's the best way to upload all the mixtapes. (I'm thinking something like Amazon S3).
Do I have to upload a zipped file with the entire mixtape, and each individual song, or just the zipped file.
How do i show the information of each song (title, length, etc)
Ofcourse the biggest problem is the streaming of the mixtape, and the download of the file.
Can anyone guide me as to whats the best way to create this app. (Is Rails the best way to do it?)
Thanks in advance.
You're on the right track with S3. Use paperclip in conjunction with it if you want to make some sort of GUI for you to upload stuff with.
For streaming check out jPlayer, which is a jQuery plugin.
Download's no biggie. Check out Rails' send file. For sending from a remote source like S3, look here.

Stream Videos Online and Access Rights

I have a web application that i have developed in RoR 2.1. In the app, users have the privilege of uploading media files. Currently, only FLV videos can be streamed online since i have given FLV player browser support.I have used the gem Mime Types to identify the file fomats of the media files being uploaded.
I would like to get the feasibility and ways to implement two new requirements
How can i stream all videos being uploaded online? Should I convert these files to flv or
is there any other way of making it possible?
I want the users who upload the videos to set a privilege (count) of how many users can
stream this video on line at a given time. How can i implement this?
1) for streaming you should use a CDN, this should not be the responsibility of your rails app. Lots of options, I have enjoyed working with S3/Cloudfront. Streaming through your app will really hurt the scalability of your platform. Lets the good folks at the CDN deal with this.
2) To throttle the usage -- I would do the following. When a web user wants to watch a video give them a link you your app (vs directly to the CDN) so http://myapp/video/watch. In that method(VideosController#watch) you can count concurrent views, and if under the threshold then perform a secure redirect to the video.
If you must serve files directly from your server use send_file method (doc)
If you are looking for video playback, there a bunch of javascript/html5 video solutions: VideoJS is a pretty good one: http://videojs.com/, It should be able to handle many different types of video formats
enter link description here
Good luck

youtube: use youtube player in website

I am not sure , But is there any way to use YouTube video player for playing .flv file , which are stored in my own server.
any idea ?
I don't think so, you can only use it to play content hosted on their site, but there are plenty of other flash players around. Flowplayer is a common one, and there are loads more if you Google.
No.
You would have to upload the files to Youtube to use their player (which you can embed)
How ever there are many Youtube-like players (which will play .flv files on your own server), for example:
flvplayer
FPlayer
BitGravity
JW FLV Player
Flowplayer
Not that I'm aware of, but there are other options available that are very very similar.
Check out the JW Player here
I don't think so.
If you don't mind targetting just cutting-edge browsers though, you could make use of the HTML5 <video> tags:
<video src="path/to/your/video">Your browser doesn't support this.</video>
I know the beta versions of FF3.5 support this, but it is a new feature that's not widely supported yet.
Otherwise, use something like FlowPlayer as suggested in other responses.
Why not just upload the video to YouTube and embed the player?

Resources