当前位置: 动力学知识库 > 问答 > 编程问答 >

html - How to get videos to play on both mobile and desktop/laptop browsers?

问题描述:

So, I have a video streaming application and I'm currently using JW PLAYER's flash player to display video's.

See player code below:

<% if can_view_clip?(@clip, @country_code) %>

<div id='my-video<%= @clip.video.id %>'></div>

<script type='text/javascript'>

jwplayer('my-video<%= @clip.video.id %>').setup({

playlist: [{

image: "<%= @clip.video.thumbnail_url %>",

sources: [

{ file: "<%= video_url(@clip.video.remote_id, :smil) %>" },

{ file: "<%= video_url(@clip.video.remote_id, :m3u8) %>" }

]

}],

primary: "flash",

width: '100%',

height: '350',

rtmp: {

bufferlength: 7

}

});

</script>

<% else %>

<div class="no_video">

<div class="notice">Sorry! <%= @clip.film.name %> is not viewable in <%= @country_name %>.</div>

</div>

<% end %>

However, I'm having some trouble with the player playing on mobile devices and it's because I'm using a Flash player. Is there anyway that I can choose whether the browser loads html or flash players depending on the device?

Open to all suggestions here to get this working on both mobile and desktop/laptop devices.

Thanks!

分享给朋友:
您可能感兴趣的文章:
随机阅读: