Ruby on Rails Monday, January 3, 2011

Ben Eggett wrote in post #971865:
> Makes no sense, as long as the <video> content is displayed properly
> in the html that is generated, it doesn't matter if its rails, php,
> python, java, or anything else serving it. browsers read source code
> as it is. Rails has nothing to do with your video code.
> Here is some sample code of a basic html5 video I use with fallback
> support to a flash player for legacy browsers. Do some testing, first
> load it in an html in your public folder, if it plays fine in modern
> browsers, great. Then load it into a html.erb in your views folder,
> make sure everything is routed correctly and configured in your views/
> controllers appropriately. If it will load in safari, it will load on
> your iphone/pad fine. The below code I've tested and used on all apple
> devices, android devices, safari, firefox, chrome, and even older
> browsers will default to the fallback flash player, send me a message
> if you still don't get it. Remember, it is good practice to code mp4
> for webkit browsers, ogg for firefox/opera, and flash flv for IE &
> older browsers.
>
> code =>
>
> <video width="741" height="320" controls="controls"
> preload="auto" poster="http://video-js.zencoder.com/oceans-clip.png"
>>
> <source src="http://video-js.zencoder.com/oceans-clip.mp4"
> type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
> <source src="http://video-js.zencoder.com/oceans-clip.webm"
> type='video/webm; codecs="vp8, vorbis"' />
> <source src="http://video-js.zencoder.com/oceans-clip.ogv"
> type='video/ogg; codecs="theora, vorbis"' />
> <!-- Flash Fallback. Use any flash video player here. -->
> <object width="741" height="320" type="application/x-shockwave-
> flash"
> data="http://releases.flowplayer.org/swf/
> flowplayer-3.2.1.swf">
> <param name="movie" value="http://releases.flowplayer.org/swf/
> flowplayer-3.2.1.swf" />
> <param name="allowfullscreen" value="true" />
> <param name="flashvars" value='config={"playlist":["http://
> video-js.zencoder.com/oceans-clip.png", {"url": "http://video-
> js.zencoder.com/oceans-
> clip.mp4","autoPlay":false,"autoBuffering":true}]}' />
> <!-- Image Fallback. Typically the same as the poster image. --
>>
> <img src="http://video-js.zencoder.com/oceans-clip.png"
> width="741" height="320" alt="Poster Image" title="No video playback
> capabilities." />
> <!-- Download links provided for devices that can't play video in
> the browser. -->
> <img src="http://video-js.zencoder.com/oceans-clip.png"
> width="741" height="320" alt="Poster Image" />
> <p><strong>Download Video:</strong>
> <a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
> <a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</
> a>,
> <a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</
> a><br>
> </p>
> </object>
> </video>


Thanks ben your code works fine in my rails application.

but when i try to change to change the video file path to read from my
server, it fails again in ipad / iphone alone but works fine in mac
safari.

<video width="741" height="320" controls="controls"
preload="auto" poster="http://video-js.zencoder.com/oceans-clip.png"
>
<source src="/videos/MovieClip.mp4"
type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm"
type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv"
type='video/ogg; codecs="theora, vorbis"' />
<!-- Flash Fallback. Use any flash video player here. -->

</video>

Am missing some configuration here i believe or mime types.

Plz let me know

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment