|
floatWords模块使用画中画功能实现了iOS、Android悬浮提词显示功能。
- <!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{
- 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: block;
- }
- a.button{
- display: -webkit-box;
- -webkit-box-pack: center;
- -webkit-box-align: center;
- height: 36px;
- 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.6);
- }
- </style>
- </head>
- <body>
- <div id="wrap">
- <header id="header">
- <h1 id="title">模块开发</h1>
- </header>
- <div id="main">
- <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
- <a class="button" tapmode="active" onclick="canDrawOverlays()">canDrawOverlays</a>
- <a class="button" tapmode="active" onclick="openView()">预览提词视图</a>
- <a class="button" tapmode="active" onclick="hideView()">隐藏提词视图</a>
- <a class="button" tapmode="active" onclick="showView()">隐藏后显示提词视图</a>
- <a class="button" tapmode="active" onclick="closeView()">关闭提词视图</a>
- <a class="button" tapmode="active" onclick="startPlay()">开始滚动播放</a>
- <a class="button" tapmode="active" onclick="stopPlay()">停止滚动播放</a>
- <a class="button" tapmode="active" onclick="startPIP(0)">开启画中画0</a>
- <a class="button" tapmode="active" onclick="startPIP(1)">开启画中画1</a>
- <a class="button" tapmode="active" onclick="startPIP(2)">开启画中画2</a>
- <a class="button" tapmode="active" onclick="startPIP(3)">开启画中画3</a>
- <a class="button" tapmode="active" onclick="startPIP(4)">开启画中画4</a>
- <a class="button" tapmode="active" onclick="stopPIP()">停止画中画</a>
- <a class="button" tapmode="active" onclick="updateStyle1()">更新样式1</a>
- <a class="button" tapmode="active" onclick="updateStyle2()">更新样式2</a>
- <a class="button" tapmode="active" onclick="updateSpeed(10)">更新速度1</a>
- <a class="button" tapmode="active" onclick="updateSpeed(50)">更新速度2</a>
- <a class="button" tapmode="active" onclick="updateSpeed(100)">更新速度3</a>
- <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
- </div>
- </div>
- </body>
- <script>
- var demo;
- function canDrawOverlays() {
- demo.canDrawOverlays(function(ret, err){
- alert(JSON.stringify(ret));
- });
- }
- function openView() {
- demo.openView({
- rect : {
- x : 20,
- y : 50,
- w: api.frameWidth - 40,
- h: api.frameHeight/3
- },
- fixedOn: api.frameName,
- fixed: true,
- //text : '文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n '
- text : '\n1\n2\n3\n4\n5\n6\n7\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view\n文本文本文本文本文本文本文本文本文本文本文本文本可以放任意view'
- },function(ret, err){
- alert(JSON.stringify(ret));
- });
- }
- function hideView() {
- demo.hideView(function(ret, err){
- alert(JSON.stringify(ret));
- });
- }
-
- function showView() {
- demo.showView(function(ret, err){
- alert(JSON.stringify(ret));
- });
- }
-
- function closeView() {
- demo.closeView(function(ret, err){
- alert(JSON.stringify(ret));
- });
- }
-
- function startPlay() {
- var ret = demo.startPlay();
- alert(JSON.stringify(ret));
- }
-
- function stopPlay() {
- var ret = demo.stopPlay();
- alert(JSON.stringify(ret));
- }
-
- function startPIP(type) {
- demo.startPIP({
- videoType : type,
- countDown : 6,
- },function(ret, err){
- alert(JSON.stringify(ret));
- });
- }
-
- function stopPIP() {
- var ret = demo.stopPIP();
- alert(JSON.stringify(ret));
- }
- function updateStyle1() {
- var ret = demo.updateStyle({
- backgroundColor: '#FFFFFF',
- textFontColor: '#000000',
- textFontSize: 30,
- });
- alert(JSON.stringify(ret));
- }
-
-
- function updateStyle2() {
- var ret = demo.updateStyle({
- backgroundColor: '#FFB6C1',
- textFontColor: '#DA70D6',
- textFontSize: 14,
- });
- alert(JSON.stringify(ret));
- }
-
- function updateSpeed(s) {
- var ret = demo.updateSpeed({
- speed: s,
- });
- alert(JSON.stringify(ret));
- }
-
- function apiready() {
- var header = document.getElementById('header');
- header.style.paddingTop = api.safeArea.top + 'px';
-
- api.removeLaunchView();
-
- demo = api.require('floatWords');
- }
- </script>
- </html>
复制代码
|
|