|
[插件开发]
videoPicture模块demo示例
[复制链接]
本帖最后由 52yaoer 于 2020-9-24 10:08 编辑
videoPicture模块用ijkplayer封装在iOS、Android下带视频播放的轮播功能(本底层是基于ijkplayer,播放类型支持比较多,如果需要轻便的播放器底层(如:仅播放MP4)可以单独联系封装)。
点击进入模块详情
- <!DOCTYPE html>
- <html>
- <head>
- <title>Module Develop</title>
- <meta charset="utf-8">
- <meta name="viewport"
- content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
- <style type="text/css">
- html,
- body {
- height: 100%
- }
- body {
- background-color: #fff;
- margin: 0;
- }
- #wrap {
- height: 100%;
- position: relative;
- }
- #header {
- padding-top: 20px;
- background-color: #5082c2;
- height: 44px;
- position: relative;
- }
- #header h1 {
- font-size: 20px;
- height: 44px;
- line-height: 44px;
- margin: 0em;
- color: #fff;
- margin-left: 100px;
- margin-right: 100px;
- text-align: center;
- }
- #main {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-box-pack: center;
- }
- a.button {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-box-pack: center;
- -webkit-box-align: center;
- height: 32px;
- margin: 8px;
- background-color: rgba(240, 240, 240, 1.0);
- border-color: rgba(220, 220, 220, 1.0);
- border-width: 2px;
- border-style: solid;
- }
- a.active {
- background-color: rgba(240, 240, 240, 0.7);
- }
- </style>
- </head>
- <body>
- <div id="wrap">
- <div id="main">
- <a class="button" tapmode="active" onclick="requestPermission()">requestPermission</a>
- <a class="button" tapmode="active" onclick="openCarousel()">openCarousel</a>
- <a class="button" tapmode="active" onclick="closeCarousel()">closeCarousel</a>
- <a class="button" tapmode="active" onclick="showCarousel()">showCarousel</a>
- <a class="button" tapmode="active" onclick="hideCarousel()">hideCarousel</a>
- </div>
- </div>
- </body>
- <script type="text/javascript">
- var demo = null;
- apiready = function () {
- demo = api.require('videoPicture');
- if (!demo) {
- alert("请添加模块后编译");
- return;
- }
- }
- function requestPermission() {
- api.requestPermission({
- list: ['storage', 'photos'],
- }, function (ret, err) {
- api.alert({
- msg: JSON.stringify(ret)
- });
- });
- }
- function openCarousel() {
- demo.openCarousel({
- rect: {
- x: 30,
- y: 400,
- w: 300,
- h: 200,
- fixedOn: 'index_frm', //固定在名为'index_frm'的frame上
- //fixed:false //跟随网页滚动
- },
- data: [{
- imageUrl: 'http://img**.**/3332-1518523974124-26',
- type: 1,//1:视频 2:图片 如果是带视频的轮播。第一个必须是视频
- videoUrl: 'https://v-cdn**.**.cn/123468.mp4'
- }, {
- imageUrl: 'http://img**.**/3332-1518523974126-29',
- type: 2,
- }, {
- imageUrl: 'http://img**.**/3332-1518523974125-28',
- type: 2,
- }, {
- imageUrl: 'http://img**.**/3332-1518523974125-27',
- type: 2,
- }, {
- imageUrl: 'http://img**.**/3332-1518523974124-26',
- type: 2,
- }, {
- imageUrl: 'http://img**.**/3332-1518523974124-26',
- type: 1,
- }]
- }, function (ret, err) {
- alert(JSON.stringify(ret));
- });
- }
- function closeCarousel() {
- demo.closeCarousel();
- }
- function showCarousel() {
- demo.showCarousel();
- }
- function hideCarousel() {
- demo.hideCarousel();
- }
- </script>
- </html>
复制代码
|
|