使用jquery mobile进行移动网页开发

12 篇文章 0 订阅
4 篇文章 0 订阅
我所使用的技术是: jquery mobile, jwplayer(因为需要播放视频文件)

需要做的页面分析:
1,一个视频的列表页面
2, 单个视频的播放页面

先准备一个固定的模板
<!DOCTYPE html>
<html>
  <head>
    <title>酷拍手机视频聊天</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
    <%=stylesheet_link_tag "mobile" %>
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
  </head>

  <body>
    <div data-role="page">

      <div data-role="header">
        <h1>酷拍手机视频聊天</h1>
      </div>

      <div data-role="content">
        <%=yield %>
      </div>

      <div data-role="footer">
        <h4>@酷拍手机视频聊天</h4>
      </div>
    </div>

  </body>
</html>

rails端准备的数据就不说了,记录一下列表的结构
<div class="content-primary">
  <ul class="listview-v" data-role="listview">
    <% @videos.each do |obj| %>
    <li>
    <a href="/video/<%=obj.id %>.mobile" data-ajax="false" rel="external">
      <img src="<%=obj.preview %>" width="90px" height="90px" />
      <h3><%=obj.title_m %></h3>
      <p>拍摄于<%=obj.created_at.strftime("%Y-%m-%d %H:%M") %></p>
    </a>
    </li>
    <% end %>
  </ul>
</div>

android端的播放页面如下
<video  poster="<%=@video.preview %>" id="myVideo">
<source src="<%=@video.url %>" type="video/flv">
</video>
<script>
  jwplayer("myVideo").setup({
    modes: [
      { type: 'html5' },
      { type: 'flash', src: '/jwplayer/player.swf' }
    ],
    controlbar: 'bottom',
  });
</script>

以上代码有一个问题,就是会自动的访问 index 页面,原因有待查明




参考文档:
jwplayer用在html5中
http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/22644/using-the-html5-video-tag

jquery mobile的api文档
http://jquerymobile.com/demos/1.0.1/

终端判断的gem, 为移动设备单独准备的format
mobile-fu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值