WeChat develops online on-demand movie network and movie network basic function implementation code

高洛峰
Release: 2017-03-24 15:04:51
Original
5491 people have browsed it

We introduced the ckplayer player, the core part of the movie network, in the previous lesson, so we will complete this movie network based on the previous lesson.

Let’s first create an index.html. The code is as follows:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>夺命雷公狗之电影在线点播网</title>
        <!--宽高禁缩放 -->
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
        <!--类webapp--> 
        <meta name="apple-mobile-web-app-capable" content="yes">
        <!--状态条 --> 
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <!--电话号码不是链接 --> 
        <meta name="format-detection" content="telephone=no">
        <link href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
        <script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>
        <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js" type="text/javascript"></script>
    </head>
    <body>
        <div data-role="page" id="page1">
            <div>
                <img src="banner.png" width="100%" />
            </div>
            <div data-role="content">
                <ul data-role="listview">
                    <li><a href="#page2">第二页</a></li>
                    <li><a href="#page3">第三页</a></li>
                    <li><a href="#page4">第四页</a></li>
                    <li><a href="#page5">第五页</a></li>
                </ul>
            </div>
            <div data-role="footer">
                <h1>页面脚注</h1>
            </div>
        </div>
        
        <div data-role="page" id="page2">
            <div data-role="header">
                <h1>header2</h1>
            </div>
            <div data-role="content">
                <img width="200px" src="http://i.cnblogs.com/images/adminlogo.gif" />
            </div>
            <div data-role="footer">
                <h1>页面脚注</h1>
            </div>
        </div>
        
        <div data-role="page" id="page3">
            <div data-role="header">
                <h1>header3</h1>
            </div>
            <div data-role="content">
                内容3
            </div>
            <div data-role="footer">
                <h1>footer3</h1>
            </div>
        </div>
        
        <div data-role="page" id="page4">
            <div data-role="header">
                <h1>header4</h1>
            </div>
            <div data-role="content">
                <b>内容4</b>
            </div>
            <div data-role="footer">
                <h1>footer4    </h1>
            </div>
        </div>
        
        <div data-role="page" id="page5">
            <div data-role="header">
                <h1>header5</h1>
            </div>
            <div data-role="content">
                <h1>内容5</h1>
            </div>
            <div data-role="footer">
                <h1>footer5</h1>
            </div>
        </div>
    </body>
<html>
Copy after login

After the home page is written, the next step is to go to his movie details page. The movie.html code is as follows As shown:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>电影详情页</title>
        <!--宽高禁缩放 -->
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
        <!--类webapp--> 
        <meta name="apple-mobile-web-app-capable" content="yes">
        <!--状态条 --> 
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <!--电话号码不是链接 --> 
        <meta name="format-detection" content="telephone=no">
        <link href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
        <script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>
        <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js" type="text/javascript"></script>
    </head>
    <body>
        <div data-role="page" id="page1">
            <div data-role="header">
                <img src="mv1.png" width="100%" />
            </div>
            <div data-role="content">
            <font style="font-size:24px;color:red;"><b>剧情介绍</b></font><br /><br />
            <font style="font-size:20px;color:red;"><b>白发魔女传之明月天国</b></font><br /><br />
            明朝万历年间,刚刚被推举为武当派新任掌门的卓一航(黄晓明饰)奉命带红丸入京进贡,沿途偶遇魔教妖女练霓裳(范冰冰饰),二人从不打不相识到情难自禁坠入爱河,并在练霓裳所驻扎的明月寨中互许终身。不久,锦衣卫攻入明月寨,指出练霓裳就是杀死川陕总督卓仲廉的凶手,卓一航为查明真相只身前往京城。不久后却传来他归顺朝廷并另娶娇妻的消息,练霓裳悲愤交集,一夜间黑发尽数变白。<br /><br />
            <font style="font-size:24px;color:red;"><b>点击播放</b></font><br /><br />
            <!--如果我们是在实际的开发的时候这里面一定是动态的,如href=“/ckplayer/index.php?id=100”-->
            <a target="_self" href="/ckplayer/index.htm">
                <img src="movie1.png">
            </a>
            </div>
            <div data-role="footer">
                <h3>夺命雷公狗出品2015-2016</h3>
            </div>
        </div>
        
        <div data-role="page" id="page2">
            <div data-role="header">
                <h1>header2</h1>
            </div>
            <div data-role="content">
                <img width="200px" src="http://i.cnblogs.com/images/adminlogo.gif" />
            </div>
            <div data-role="footer">
                <h1>页面脚注</h1>
            </div>
        </div>
        
        <div data-role="page" id="page3">
            <div data-role="header">
                <h1>header3</h1>
            </div>
            <div data-role="content">
                内容3
            </div>
            <div data-role="footer">
                <h1>footer3</h1>
            </div>
        </div>
        
        <div data-role="page" id="page4">
            <div data-role="header">
                <h1>header4</h1>
            </div>
            <div data-role="content">
                <b>内容4</b>
            </div>
            <div data-role="footer">
                <h1>footer4    </h1>
            </div>
        </div>
        
        <div data-role="page" id="page5">
            <div data-role="header">
                <h1>header5</h1>
            </div>
            <div data-role="content">
                <h1>内容5</h1>
            </div>
            <div data-role="footer">
                <h1>footer5</h1>
            </div>
        </div>
    </body>
<html>
Copy after login

Then the last step is the movie playback page. We can directly link the details address to /ckplayer/index.htm. The code is as follows:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>夺命雷公狗电影点播系统</title>
<style type="text/css">
body,td,th {
    font-size: 14px;
    line-height: 26px;
}
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
p {
    margin-top: 5px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    padding-left: 10px;
}
#a1{
    /*播放器大小的设置*/
    position:relative;
    z-index: 100;
    width:900px;
    height:600px;
    float: left;
}
</style>
<script type="text/javascript" src="js/offlights.js"></script>
</head>

<body>
<div id="a1"></div>
<!--
上面一行是播放器所在的容器名称,如果只调用flash播放器,可以只用<div id="a1"></div>
-->
<script type="text/javascript" src="ckplayer/ckplayer.js" charset="utf-8"></script>
<script type="text/javascript">
    //如果你不需要某项设置,可以直接删除,注意var flashvars的最后一个值后面不能有逗号
//    function loadedHandler(){
//        if(CKobject.getObjectById(&#39;ckplayer_a1&#39;).getType()){//说明使用html5播放器
//            alert(&#39;播放器已加载,调用的是HTML5播放模块&#39;);
//        }
//        else{
//            alert(&#39;播放器已加载,调用的是Flash播放模块&#39;);
//        }
//    }
    var _nn=0;
    function ckplayer_status(str){
        _nn+=1;
        if(_nn>100){
            _nn=0;
            document.getElementById(&#39;statusvalue&#39;).value=&#39;&#39;;
        }
        document.getElementById(&#39;statusvalue&#39;).value=str+&#39;\n&#39;+document.getElementById(&#39;statusvalue&#39;).value;
    }
    
    var flashvars={
        f:&#39;http://weixin.showtp.com/ckplayer/test.flv&#39;,//视频地址
        a:&#39;&#39;,//调用时的参数,只有当s>0的时候有效
        s:&#39;0&#39;,//调用方式,0=普通方法(f=视频地址),1=网址形式,2=xml形式,3=swf形式(s>0时f=网址,配合a来完成对地址的组装)
        c:&#39;0&#39;,//是否读取文本配置,0不是,1是
        x:&#39;&#39;,//调用配置文件路径,只有在c=1时使用。默认为空调用的是ckplayer.xml
        i:&#39;http://www.ckplayer.com/images/loadimg3.jpg&#39;,//初始图片地址
        d:&#39;http://www.ckplayer.com/down/pause6.1_1.swf|http://www.ckplayer.com/down/pause6.1_2.swf&#39;,//暂停时播放的广告,swf/图片,多个用竖线隔开,图片要加链接地址,没有的时候留空就行
        u:&#39;&#39;,//暂停时如果是图片的话,加个链接地址
        l:&#39;http://www.ckplayer.com/down/adv6.1_1.swf|http://www.ckplayer.com/down/adv6.1_2.swf&#39;,//前置广告,swf/图片/视频,多个用竖线隔开,图片和视频要加链接地址
        r:&#39;&#39;,//前置广告的链接地址,多个用竖线隔开,没有的留空
        t:&#39;10|10&#39;,//视频开始前播放swf/图片时的时间,多个用竖线隔开
        y:&#39;&#39;,//这里是使用网址形式调用广告地址时使用,前提是要设置l的值为空
        z:&#39;http://www.ckplayer.com/down/buffer.swf&#39;,//缓冲广告,只能放一个,swf格式
        e:&#39;3&#39;,//视频结束后的动作,0是调用js函数,1是循环播放,2是暂停播放并且不调用广告,3是调用视频推荐列表的插件,4是清除视频流并调用js功能和1差不多,5是暂停播放并且调用暂停广告
        v:&#39;80&#39;,//默认音量,0-100之间
        p:&#39;1&#39;,//视频默认0是暂停,1是播放,2是不加载视频
        h:&#39;0&#39;,//播放http视频流时采用何种拖动方法,=0不使用任意拖动,=1是使用按关键帧,=2是按时间点,=3是自动判断按什么(如果视频格式是.mp4就按关键帧,.flv就按关键时间),=4也是自动判断(只要包含字符mp4就按mp4来,只要包含字符flv就按flv来)
        q:&#39;&#39;,//视频流拖动时参考函数,默认是start
        m:&#39;&#39;,//让该参数为一个链接地址时,单击播放器将跳转到该地址
        o:&#39;&#39;,//当p=2时,可以设置视频的时间,单位,秒
        w:&#39;&#39;,//当p=2时,可以设置视频的总字节数
        g:&#39;&#39;,//视频直接g秒开始播放
        j:&#39;&#39;,//跳过片尾功能,j>0则从播放多少时间后跳到结束,<0则总总时间-该值的绝对值时跳到结束
        k:&#39;30|60&#39;,//提示点时间,如 30|60鼠标经过进度栏30秒,60秒会提示n指定的相应的文字
        n:&#39;这是提示点的功能,如果不需要删除k和n的值|提示点测试60秒&#39;,//提示点文字,跟k配合使用,如 提示点1|提示点2
        wh:&#39;&#39;,//宽高比,可以自己定义视频的宽高或宽高比如:wh:&#39;4:3&#39;,或wh:&#39;1080:720&#39;
        lv:&#39;0&#39;,//是否是直播流,=1则锁定进度栏
        loaded:&#39;loadedHandler&#39;,//当播放器加载完成后发送该js函数loaded
        //调用播放器的所有参数列表结束
        //以下为自定义的播放器参数用来在插件里引用的
        my_url:encodeURIComponent(window.location.href)//本页面地址
        //调用自定义播放器参数结束
        };
    var params={bgcolor:&#39;#FFF&#39;,allowFullScreen:true,allowScriptAccess:&#39;always&#39;};//这里定义播放器的其它参数如背景色(跟flashvars中的b不同),是否支持全屏,是否支持交互
    var video=[&#39;http://weixin.showtp.com/ckplayer/test.flv&#39;];
    CKobject.embed(&#39;ckplayer/ckplayer.swf&#39;,&#39;a1&#39;,&#39;ckplayer_a1&#39;,&#39;100%&#39;,&#39;100%&#39;,false,flashvars,video,params);
    /*
        以上代码演示的兼容flash和html5环境的。如果只调用flash播放器或只调用html5请看其它示例
    */
    function videoLoadJs(s){
        alert("执行了播放");
    }
    function playerstop(){
        //只有当调用视频播放器时设置e=0或4时会有效果
        alert(&#39;播放完成&#39;);    
    }
    var _nn=0;//用来计算实时监听的条数的,超过100条记录就要删除,不然会消耗内存
    
    function getstart(){
        var a=CKobject.getObjectById(&#39;ckplayer_a1&#39;).getStatus();
        var ss=&#39;&#39;;
        for (var k in a){
            ss+=k+":"+a[k]+&#39;\n&#39;;
        }
        alert(ss);
    }
    function ckadjump(){
        alert(&#39;这里演示了点击跳过广告按钮后的执行的动作,如果注册会员可以做成直接跳过的效果。&#39;);
    }
    //开关灯
    var box = new LightBox();
    function closelights(){//关灯
        box.Show();
        CKobject._K_(&#39;a1&#39;).style.width=&#39;940px&#39;;
        CKobject._K_(&#39;a1&#39;).style.height=&#39;550px&#39;;
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).width=940;
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).height=550;
    }
    function openlights(){//开灯
        box.Close();
        CKobject._K_(&#39;a1&#39;).style.width=&#39;600px&#39;;
        CKobject._K_(&#39;a1&#39;).style.height=&#39;400px&#39;;
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).width=600;
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).height=400;
    }
    function changePrompt(){
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).promptUnload();//卸载掉目前的
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).changeFlashvars(&#39;{k->10|20|30}{n->重设提示点一|重设提示点二|重设提示点三}&#39;);
        CKobject.getObjectById(&#39;ckplayer_a1&#39;).promptLoad();//重新加载
    }
    function addflash(){
        if(CKobject.Flash()[&#39;f&#39;]){
            CKobject._K_(&#39;a1&#39;).innerHTML=&#39;&#39;;
            CKobject.embedSWF(&#39;ckplayer/ckplayer.swf&#39;,&#39;a1&#39;,&#39;ckplayer_a1&#39;,&#39;600&#39;,&#39;400&#39;,flashvars,params);
        }
        else{
            alert(&#39;该环境中没有安装flash插件,无法切换&#39;);
        }
    }
    function addhtml5(){
        if(CKobject.isHTML5()){
            support=[&#39;all&#39;];
            CKobject._K_(&#39;a1&#39;).innerHTML=&#39;&#39;;
            CKobject.embedHTML5(&#39;a1&#39;,&#39;ckplayer_a1&#39;,600,400,video,flashvars,support);
        }
        else{
            alert(&#39;该环境不支持html5,无法切换&#39;);
        }
    }
    function addListener(){
        if(CKobject.getObjectById(&#39;ckplayer_a1&#39;).getType()){//说明使用html5播放器
            CKobject.getObjectById(&#39;ckplayer_a1&#39;).addListener(&#39;play&#39;,playHandler);
        }
        else{
            CKobject.getObjectById(&#39;ckplayer_a1&#39;).addListener(&#39;play&#39;,&#39;playHandler&#39;);
        }
    }
    function playHandler(){
        alert(&#39;因为注册了监听播放,所以弹出此内容,删除监听将不再弹出&#39;);
    }
    function removeListener(){//删除监听事件
        if(CKobject.getObjectById(&#39;ckplayer_a1&#39;).getType()){//说明使用html5播放器
            CKobject.getObjectById(&#39;ckplayer_a1&#39;).removeListener(&#39;play&#39;,playHandler);
        }
        else{
            CKobject.getObjectById(&#39;ckplayer_a1&#39;).removeListener(&#39;play&#39;,&#39;playHandler&#39;);
        }
    }
</script>
</body>
</html>
Copy after login

The above is the detailed content of WeChat develops online on-demand movie network and movie network basic function implementation code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template