diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..1a3af920b098c1460143e5f5ef5174933e03cb54 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/App.uvue b/App.uvue new file mode 100644 index 0000000000000000000000000000000000000000..a1ead0e7dbceb3636d82303392c1df1e6b9f7a24 --- /dev/null +++ b/App.uvue @@ -0,0 +1,44 @@ + + + \ No newline at end of file diff --git a/main.uts b/main.uts new file mode 100644 index 0000000000000000000000000000000000000000..89d8f152127b8105c47b6ef81680535f4dbbb40c --- /dev/null +++ b/main.uts @@ -0,0 +1,9 @@ +import App from './App' + +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 969da0b24396e4731a209a484570880a4b90ed48..2d0bfae738f8df3b82dd30b17ffe9dae30f7c90d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,72 +1,60 @@ -{ - "name" : "uni-component", - "appid" : "__UNI__0094991", - "description" : "uts组件示例", - "versionName" : "1.0.0", - "versionCode" : "100", - "transformPx" : false, - /* 5+App特有相关 */ - "app-plus" : { - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - /* 模块配置 */ - "modules" : {}, - /* 应用发布信息 */ - "distribute" : { - /* android打包配置 */ - "android" : { - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - /* ios打包配置 */ - "ios" : {}, - /* SDK配置 */ - "sdkConfigs" : {} - } - }, - /* 快应用特有相关 */ - "quickapp" : {}, - /* 小程序特有相关 */ - "mp-weixin" : { - "appid" : "", - "setting" : { - "urlCheck" : false - }, - "usingComponents" : true - }, - "mp-alipay" : { - "usingComponents" : true - }, - "mp-baidu" : { - "usingComponents" : true - }, - "mp-toutiao" : { - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false - }, - "vueVersion" : "3" -} +{ + "name": "uni-component", + "appid": "__UNI__0094991", + "description": "uts组件示例", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + /* uni-app x 特有相关 */ + // "uni-app-x": {}, + /* uni-app特有相关 */ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + /* 模块配置 */ + "modules": {}, + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": {}, + /* ios打包配置 */ + "ios": { + "dSYMs": false + }, + /* SDK配置 */ + "sdkConfigs": { + "ad": {} + } + } + }, + /* 快应用特有相关 */ + "quickapp": {}, + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "uniStatistics": { + "enable": false + }, + "vueVersion": "3" +} \ No newline at end of file diff --git a/pages.json b/pages.json index 869105d7cfb153fa6966202089e6246708a6f6af..d58033cb0d3f5d29583a940c16513a587c510e80 100644 --- a/pages.json +++ b/pages.json @@ -1,17 +1,31 @@ -{ - "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "uni-app" - } - } - ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "uni-app", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" - }, - "uniIdRouter": {} +{ + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "uni-app" + } + }, + { + "path": "pages/animation-view/animation-view", + "style": { + "navigationBarTitleText": "animation-view", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/video-view/video-view", + "style": { + "navigationBarTitleText": "video-view", + "enablePullDownRefresh": false + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "uniIdRouter": {} } diff --git a/pages/animation-view/animation-view.nvue b/pages/animation-view/animation-view.nvue new file mode 100644 index 0000000000000000000000000000000000000000..1927c6e1f05995f6f143b452a6599ffbf58b315c --- /dev/null +++ b/pages/animation-view/animation-view.nvue @@ -0,0 +1,70 @@ + + + + + diff --git a/pages/animation-view/animation-view.uvue b/pages/animation-view/animation-view.uvue new file mode 100644 index 0000000000000000000000000000000000000000..1927c6e1f05995f6f143b452a6599ffbf58b315c --- /dev/null +++ b/pages/animation-view/animation-view.uvue @@ -0,0 +1,70 @@ + + + + + diff --git a/pages/index/index.nvue b/pages/index/index.nvue index 0aa8945b38875066696ab3e968135b48ca5d45ac..bc330a253ef70e1babbb1aa08f6c9a070549d163 100644 --- a/pages/index/index.nvue +++ b/pages/index/index.nvue @@ -1,52 +1,68 @@ - - - - - + + + + + \ No newline at end of file diff --git a/pages/index/index.uvue b/pages/index/index.uvue new file mode 100644 index 0000000000000000000000000000000000000000..c498eccaf0875f616dffc417f5e01feb58015c9f --- /dev/null +++ b/pages/index/index.uvue @@ -0,0 +1,68 @@ + + + + + diff --git a/pages/video-view/video-view.nvue b/pages/video-view/video-view.nvue new file mode 100644 index 0000000000000000000000000000000000000000..29262181e3c23301d97b6207c2c026429d3fdb03 --- /dev/null +++ b/pages/video-view/video-view.nvue @@ -0,0 +1,65 @@ + + + + + diff --git a/pages/video-view/video-view.uvue b/pages/video-view/video-view.uvue new file mode 100644 index 0000000000000000000000000000000000000000..3f2f62f5126ac517167ac9f3cad0020ab1d029d9 --- /dev/null +++ b/pages/video-view/video-view.uvue @@ -0,0 +1,72 @@ + + + + + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..6e3b67821008ce8769c1e3525cbfe5177796f106 --- /dev/null +++ b/readme.md @@ -0,0 +1,21 @@ +此项目为开源uts组件插件。 + + +## 注意事项 +uts组件插件基本都会依赖三方SDK,需要使用自定义基座才能正常运行。 + +此项目默认为uni-app项目,如果要切换为uni-app x项目,需打开manifest.json,去掉uni-app-x节点的注释: +``` + /* uni-app x 特有相关 */ + // "uni-app-x": {}, +``` +关闭manifest.json后重新打开即可。 + + +## uni-animation-view +动画组件 animation-view + + +## uni-video +视频播放组件 video-view,暂时仅支持Android平台的 uni-app x 项目 + diff --git a/uni_modules/uni-animation-view/changelog.md b/uni_modules/uni-animation-view/changelog.md index a5a3c3d99c5d06a496423aa2eb622e4abfe67fc4..778834e539962944faaa5e21e80ff6c8c2d47931 100644 --- a/uni_modules/uni-animation-view/changelog.md +++ b/uni_modules/uni-animation-view/changelog.md @@ -1,2 +1,5 @@ -## 1.0.0(2023-01-16) -实现android/ios平台animation-view组件,仅支持nvue页面 +## 1.0.0(2023-01-16) +实现android/ios平台 animation-view 组件,仅支持 nvue 页面 + +## 1.0.1(2023-10-23) +android平台适配 uni-app x 项目,支持 uvue 页面,需使用 HBuilderX3.94+ 版本 diff --git a/uni_modules/uni-animation-view/package.json b/uni_modules/uni-animation-view/package.json index 1ab51db88ccd81812ee47dbc7846545a7f374647..afd95ec48164d0ae227cde1906b36497385727a2 100644 --- a/uni_modules/uni-animation-view/package.json +++ b/uni_modules/uni-animation-view/package.json @@ -1,7 +1,7 @@ { "id": "uni-animation-view", "displayName": "animation-view", - "version": "1.0.0", + "version": "1.0.1", "description": "使用uts组件开发,实现animation-view组件", "keywords": [ "animation-view", diff --git a/uni_modules/uni-animation-view/readme.md b/uni_modules/uni-animation-view/readme.md index 118c91fad572d9a600adcaf799f1c6e4581acce0..b8692ca203685c384f12afa1014622e84f526ff5 100644 --- a/uni_modules/uni-animation-view/readme.md +++ b/uni_modules/uni-animation-view/readme.md @@ -1,79 +1,86 @@ -# animation-view - -> animation-view组件是[uts插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html),需 HBuilderX 3.7.0+ - -> 使用文档:[https://uniapp.dcloud.net.cn/component/animation-view.html](https://uniapp.dcloud.net.cn/component/animation-view.html) - - -### 属性说明 - -|属性名|类型|默认值|说明| -|:-|:-|:-|:-| -| path | String | | 动画资源地址,支持本地路径和网络路径 | -| loop | Boolean | false | 动画是否循环播放 | -| autoplay | Boolean | true | 动画是否自动播放 | -| action | String | play | 动画操作,可取值 play、pause、stop | -| hidden | Boolean | true | 是否隐藏动画 | -| @bindended | EventHandle | | 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发) | - - -**注意** -* animation-view 仅App端nvue页面支持 -* App端实现使用了Lottie三方SDK,参考开源项目:[Lottie for Android](https://github.com/airbnb/lottie-android),[Lottie for iOS](https://github.com/airbnb/lottie-ios) -* App-Android平台要求Android5(API Leavel 21)及以上系统 -* App-iOS平台要求iOS11及以上版本系统 - - -### 代码示例 - -```html - - - - - -``` - - - - - - +## uts插件开发文档 +[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html) +[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html) +[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html) +[Hello UTS](https://gitcode.net/dcloud/hello-uts) + + +## animation-view + +> animation-view组件是[uts插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html),需 HBuilderX 3.7.0+ + +> 使用文档:[https://uniapp.dcloud.net.cn/component/animation-view.html](https://uniapp.dcloud.net.cn/component/animation-view.html) + + +### 属性说明 + +|属性名|类型|默认值|说明| +|:-|:-|:-|:-| +| path | String | | 动画资源地址,支持本地路径和网络路径 | +| loop | Boolean | false | 动画是否循环播放 | +| autoplay | Boolean | true | 动画是否自动播放 | +| action | String | play | 动画操作,可取值 play、pause、stop | +| hidden | Boolean | true | 是否隐藏动画 | +| @bindended | EventHandle | | 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发) | + + +**注意** +* animation-view 仅App端nvue页面支持 +* App端实现使用了Lottie三方SDK,参考开源项目:[Lottie for Android](https://github.com/airbnb/lottie-android),[Lottie for iOS](https://github.com/airbnb/lottie-ios) +* App-Android平台要求Android5(API Leavel 21)及以上系统 +* App-iOS平台要求iOS11及以上版本系统 + + +### 代码示例 + +```html + + + + + +``` + + + + + + diff --git a/uni_modules/uni-animation-view/utssdk/app-android/index.vue b/uni_modules/uni-animation-view/utssdk/app-android/index.vue index d47fe8869eeb86032e1dba8b07db993615c712f8..1b5a76710e2ebb6228c07c25b43a29f3c34b59ff 100644 --- a/uni_modules/uni-animation-view/utssdk/app-android/index.vue +++ b/uni_modules/uni-animation-view/utssdk/app-android/index.vue @@ -35,7 +35,7 @@ //原生提供以下属性或方法的实现 export default { - name: "uts-animation-view", + name: "animation-view", /** * 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发) */ diff --git a/uni_modules/uni-animation-view/utssdk/web/index.vue b/uni_modules/uni-animation-view/utssdk/web/index.vue deleted file mode 100644 index efaa0bbc9c7aaeb1e9fb649ae2f04a932f47cfaf..0000000000000000000000000000000000000000 --- a/uni_modules/uni-animation-view/utssdk/web/index.vue +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/uni_modules/uni-video/changelog.md b/uni_modules/uni-video/changelog.md index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1dfcf18ecc2a578351e5971c04e91d6c6bc55114 100644 --- a/uni_modules/uni-video/changelog.md +++ b/uni_modules/uni-video/changelog.md @@ -0,0 +1,2 @@ +## 1.0.0(2023-10-26) +实现android平台 video-view 组件,仅支持 uni-app x项目的 uvue 页面 diff --git a/uni_modules/uni-video/package.json b/uni_modules/uni-video/package.json index 8edcfae8c45d514cc35e7442b317515c3928f0cc..3a7d33a6788b362776f2bcce5380a9bea54f8e2b 100644 --- a/uni_modules/uni-video/package.json +++ b/uni_modules/uni-video/package.json @@ -1,95 +1,83 @@ -{ - "id": "uni-video", - "displayName": "uni-video", - "version": "1.0.0", - "description": "uni-video", - "keywords": [ - "uni-video" -], - "repository": "", - "engines": { - "HBuilderX": "^3.7.0" - }, - "dcloudext": { - "type": "component-uts", - "sale": { - "regular": { - "price": "0.00" - }, - "sourcecode": { - "price": "0.00" - } - }, - "contact": { - "qq": "" - }, - "declaration": { - "ads": "", - "data": "", - "permissions": "" - }, - "npmurl": "" - }, - "uni_modules": { - "dependencies": [ - "uni-framework" - ], - "uni-ext-api": { - "uni": { - "createVideoContext": { - "name": "createVideoContext", - "app": { - "js": false, - "kotlin": true, - "swift": false - } - } - } - }, - "encrypt": [], - "platforms": { - "cloud": { - "tcb": "u", - "aliyun": "u" - }, - "client": { - "Vue": { - "vue2": "u", - "vue3": "u" - }, - "App": { - "app-android": "u", - "app-ios": "u" - }, - "H5-mobile": { - "Safari": "u", - "Android Browser": "u", - "微信浏览器(Android)": "u", - "QQ浏览器(Android)": "u" - }, - "H5-pc": { - "Chrome": "u", - "IE": "u", - "Edge": "u", - "Firefox": "u", - "Safari": "u" - }, - "小程序": { - "微信": "u", - "阿里": "u", - "百度": "u", - "字节跳动": "u", - "QQ": "u", - "钉钉": "u", - "快手": "u", - "飞书": "u", - "京东": "u" - }, - "快应用": { - "华为": "u", - "联盟": "u" - } - } - } - } +{ + "id": "uni-video", + "displayName": "uni-video", + "version": "1.0.0", + "description": "uni-video", + "keywords": [ + "uni-video" + ], + "repository": "", + "engines": { + "HBuilderX": "^3.7.0" + }, + "dcloudext": { + "type": "component-uts", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [ + "uni-framework" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u" + }, + "client": { + "Vue": { + "vue2": "u", + "vue3": "u" + }, + "App": { + "app-android": "y", + "app-ios": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } } \ No newline at end of file diff --git a/uni_modules/uni-video/readme.md b/uni_modules/uni-video/readme.md index 2745019f691b0d7f80a9672b4bd072044550df56..f97b72afcb39aa34520933586dc06ee666185d20 100644 --- a/uni_modules/uni-video/readme.md +++ b/uni_modules/uni-video/readme.md @@ -1,6 +1,13 @@ -# uni-video -### 开发文档 +## uts插件开发文档 [UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html) [UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html) [UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html) -[Hello UTS](https://gitcode.net/dcloud/hello-uts) \ No newline at end of file +[Hello UTS](https://gitcode.net/dcloud/hello-uts) + + +## video-view +此插件为uni-app x项目中内置 video 组件的开源uts组件插件,为了避免与内置 video 组件冲突,开源uts组件插件注册为 video-view 组件。 + +**注意** +- video-view组件不支持[uni.createVideoContext](https://uniapp.dcloud.net.cn/uni-app-x/api/create-video-context.html) + diff --git a/uni_modules/uni-video/utssdk/app-android/index.vue b/uni_modules/uni-video/utssdk/app-android/index.vue index 727fa64b276cf0252d1ac43d330b311b613419d4..e511cee41cce006fbc7eb5bcadbb985565a76de8 100644 --- a/uni_modules/uni-video/utssdk/app-android/index.vue +++ b/uni_modules/uni-video/utssdk/app-android/index.vue @@ -28,7 +28,7 @@ import { Danmu, RequestFullScreenOptions } from '../interface.uts'; export default { - name: "video", + name: "video-view", data() { return { rootView: null as FrameLayout | null, @@ -580,8 +580,8 @@ override onInfo(iMediaPlayer : IMediaPlayer | null, status : Int, extra : Int) : boolean { switch (status) { case MediaPlayerParams.STATE_COMPLETED: - if ((this.comp as VideoComponent).loop) { - let initialTime = (this.comp as VideoComponent).initialTime as Int; + if ((this.comp as VideoViewComponent).loop) { + let initialTime = (this.comp as VideoViewComponent).initialTime as Int; if (initialTime > 0) this.playerView.seekTo(initialTime * 1000); this.playerView.start(); } diff --git a/uni_modules/uni-video/utssdk/app-ios/index.vue b/uni_modules/uni-video/utssdk/app-ios/index.vue deleted file mode 100644 index 1b0b528488e0c97b8861e399b39cd26f38f43863..0000000000000000000000000000000000000000 --- a/uni_modules/uni-video/utssdk/app-ios/index.vue +++ /dev/null @@ -1,20 +0,0 @@ - - diff --git a/uni_modules/uni-video/utssdk/index.uts b/uni_modules/uni-video/utssdk/index.uts deleted file mode 100644 index 0f13918e104360c7f28379b1d904e65721924cff..0000000000000000000000000000000000000000 --- a/uni_modules/uni-video/utssdk/index.uts +++ /dev/null @@ -1,58 +0,0 @@ -import { ComponentPublicInstance } from 'vue' -import { CreateVideoContext, VideoContext, RequestFullScreenOptions, Danmu } from './interface' -import { UniVideoElement } from './app-android/index.vue' - -export const createVideoContext : CreateVideoContext = function (videoId : VideoIdString, component : ComponentPublicInstance | null) : VideoContext | null { - let videoElement : Element | null = null; - if (component == null) { - const pages = getCurrentPages(); - if (pages.length > 0) { - videoElement = pages[pages.length - 1].$querySelector('#' + videoId); - } - } else { - videoElement = component.$querySelector('#' + videoId); - } - if (videoElement == null) return null; - return new VideoContextImpl(videoElement as UniVideoElement); -} - -class VideoContextImpl implements VideoContext { - - private videoElement : UniVideoElement; - - constructor(videoElement : UniVideoElement) { - this.videoElement = videoElement; - } - - play() { - this.videoElement.play(); - } - - pause() { - this.videoElement.pause(); - } - - seek(position : number) { - this.videoElement.seek(position); - } - - stop() { - this.videoElement.stop(); - } - - sendDanmu(danmu : Danmu) { - this.videoElement.sendDanmu(danmu); - } - - playbackRate(rate : number) { - this.videoElement.playbackRate(rate); - } - - requestFullScreen(direction : RequestFullScreenOptions | null) { - this.videoElement.requestFullScreen(direction); - } - - exitFullScreen() { - this.videoElement.exitFullScreen(); - } -} \ No newline at end of file diff --git a/uni_modules/uni-video/utssdk/interface.uts b/uni_modules/uni-video/utssdk/interface.uts index dbba10de8a37d17498110f3b68ce8c9d9d72b05a..c2748559ffba75e3a32d41d7edf665772075df35 100644 --- a/uni_modules/uni-video/utssdk/interface.uts +++ b/uni_modules/uni-video/utssdk/interface.uts @@ -1,6 +1,3 @@ -import { ComponentPublicInstance } from 'vue' - -export type CreateVideoContext = (videoId: VideoIdString, component?: ComponentPublicInstance | null) => VideoContext | null; export type Danmu = { /** @@ -147,25 +144,3 @@ export interface VideoContext { */ exitFullScreen(): void; } - -export interface Uni { - /** - * 创建并返回 video 上下文 videoContext 对象 - * @description 创建并返回 video 上下文 videoContext 对象 - * @uniPlatform { - * "app": { - * "android": { - * "osVer": "4.4", - * "uniVer": "√", - * "unixVer": "√" - * } - * } - * } - * @uniVueVersion 2,3 - * @return {VideoContext} 视频对象 - * - * @tutorial http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext - * - */ - createVideoContext(videoId : string | HBuilderX.VideoIdString, component?: ComponentPublicInstance | null) : VideoContext | null -} \ No newline at end of file