Merge pull request #26 from langyuxiansheng/dev_v1.2.3

优化播放器的初始化代码,调整包内结构,优化局部组件的注册方式,也兼容老版本的引用方式.文档部分更新
This commit is contained in:
langyuxiansheng 2020-09-28 09:52:55 +08:00 committed by GitHub
commit 0c6acb1198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 71 additions and 143 deletions

View File

@ -24,8 +24,14 @@ Vue.use(VueAliplayerV2);
#### 局部注册 App.vue
```javascript
//推荐第一种(仅v1.2.3)及以上的版本可用
import VueAliplayerV2 from 'vue-aliplayer-v2';
components:{ VueAliplayerV2 }
//或者
components:{ VueAliplayerV2: VueAliplayerV2.Player }
```
## 2.组件中使用
@ -65,7 +71,7 @@ components:{ VueAliplayerV2: VueAliplayerV2.Player }
<script>
// import VueAliplayerV2 from 'vue-aliplayer-v2';
export default {
// components:{ VueAliplayerV2: VueAliplayerV2.Player },
// components:{ VueAliplayerV2 },
data(){
return {
options: {
@ -378,6 +384,8 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
## 更新日志
> v1.2.3 优化播放器的初始化代码,调整包内结构,优化局部组件的注册方式,也兼容老版本的引用方式.文档部分更新,增加了问题栏. 感谢"liangzhiyuan2015"和"fancheur"两位网友的反馈与建议.
> v1.2.2 修复指定id情况下,播放器报错"没有为播放器指定容器",目前移除外部指定id的方式,所有的播放器id都由内部生成,不再由外部指定容器(外部指定的意义并不大),其它的说明:更新1.2.1后报错Uncaught TypeError: 没有为播放器指定容器,因为源码中变更了部分代码,以及最大限度的简化代码,组件内部的根容器就只有一个div容器,导致以前外部指定id的时候,容器id与外部的不一致,导致抛出异常了,现在已经紧急修复了,若在使用,请更新到v1.2.2的版本;如果使用了外部指定id的方式请移除外部的id.否则id会出现重复的情况., 感谢"liyoro"的反馈和建议.
> v1.2.1 修复直播播放的情况下,播放器已经销毁,而后台还在继续下载资源造成卡顿的bug,修复多个播放器只渲染1个的bug, 感谢"Jonauil"和"guangming95"两位网友的反馈和建议.
@ -392,3 +400,16 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
> v1.1.6 修复部分已知bug和优化局部的引用方式
---
## 其它问题
1. IOS 或者其它设备无法全屏播放,或者点击全屏按钮的时候也只是显示竖屏?
> 方案与问题所在:
一般情况下可能是开启了强制竖屏(也就是屏幕锁定)打开后就会竖屏而不会全屏了!如下关闭就可以了:
参考issues: https://github.com/langyuxiansheng/vue-aliplayer-v2/issues/25
-开启了屏幕锁定,只要上拉控制中心,点击屏幕锁定关闭就可以了!
-也可能是播放器或者浏览器兼容性问题.

View File

@ -39,7 +39,7 @@
<script>
// import VueAliplayerV2 from '../packages';
export default {
// components:{ VueAliplayerV2: VueAliplayerV2.Player },
// components:{ VueAliplayerV2 },
data(){
return {
options: {

View File

@ -142,12 +142,12 @@ if (typeof window !== 'undefined') {
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js
var es6_function_name = __webpack_require__("7cfd");
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=template&id=12592c3a&
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/index.vue?vue&type=template&id=044d503d&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":_vm.playerId}})}
var staticRenderFns = []
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=template&id=12592c3a&
// CONCATENATED MODULE: ./packages/AliplayerV2/index.vue?vue&type=template&id=044d503d&
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/web.dom.iterable.js
var web_dom_iterable = __webpack_require__("4634");
@ -155,13 +155,13 @@ var web_dom_iterable = __webpack_require__("4634");
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.regexp.to-string.js
var es6_regexp_to_string = __webpack_require__("cc1d");
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js&
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/index.vue?vue&type=script&lang=js&
//
//
//
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
/* harmony default export */ var AliplayerV2vue_type_script_lang_js_ = ({
name: 'VueAliplayerV2',
props: {
options: {
@ -356,10 +356,6 @@ var es6_regexp_to_string = __webpack_require__("cc1d");
});
} else {
this.initPlayer(); //这样是为了兼容页面上有多个播放器
scriptTag.addEventListener("load", function () {
_this3.initPlayer();
});
}
},
@ -689,8 +685,8 @@ var es6_regexp_to_string = __webpack_require__("cc1d");
});
}
});
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/AliplayerV2/index.vue?vue&type=script&lang=js&
/* harmony default export */ var packages_AliplayerV2vue_type_script_lang_js_ = (AliplayerV2vue_type_script_lang_js_);
// CONCATENATED MODULE: ./node_modules/_vue-loader@15.7.2@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
@ -786,7 +782,7 @@ function normalizeComponent (
}
}
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue
// CONCATENATED MODULE: ./packages/AliplayerV2/index.vue
@ -795,7 +791,7 @@ function normalizeComponent (
/* normalize component */
var component = normalizeComponent(
src_mainvue_type_script_lang_js_,
packages_AliplayerV2vue_type_script_lang_js_,
render,
staticRenderFns,
false,
@ -805,44 +801,19 @@ var component = normalizeComponent(
)
/* harmony default export */ var main = (component.exports);
// CONCATENATED MODULE: ./packages/AliplayerV2/index.js
// 导入组件,组件必须声明 name
// 为组件添加 install 方法,用于按需引入
main.install = function (Vue) {
Vue.component(main.name, main);
};
/* harmony default export */ var AliplayerV2 = (main);
/* harmony default export */ var AliplayerV2 = (component.exports);
// CONCATENATED MODULE: ./packages/index.js
// packages / index.js
// 导入单个组件
// 以数组的结构保存组件,便于遍历
// 定义 install 方法
var components = [AliplayerV2]; // 定义 install 方法
var install = function install(Vue) {
if (install.installed) return false;
install.installed = true; // 遍历并注册全局组件
components.map(function (component) {
return Vue.component(component.name, component);
});
AliplayerV2.install = function (Vue) {
Vue.component(AliplayerV2.name, AliplayerV2);
};
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
/* harmony default export */ var packages_0 = ({
// 导出的对象必须具备一个 install 方法
install: install,
Player: AliplayerV2 // 组件列表
});
AliplayerV2.Player = AliplayerV2;
/* harmony default export */ var packages_0 = (AliplayerV2);
// CONCATENATED MODULE: ./node_modules/_@vue_cli-service@3.12.1@@vue/cli-service/lib/commands/build/entry-lib.js

View File

@ -151,12 +151,12 @@ if (typeof window !== 'undefined') {
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js
var es6_function_name = __webpack_require__("7cfd");
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=template&id=12592c3a&
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/index.vue?vue&type=template&id=044d503d&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":_vm.playerId}})}
var staticRenderFns = []
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=template&id=12592c3a&
// CONCATENATED MODULE: ./packages/AliplayerV2/index.vue?vue&type=template&id=044d503d&
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/web.dom.iterable.js
var web_dom_iterable = __webpack_require__("4634");
@ -164,13 +164,13 @@ var web_dom_iterable = __webpack_require__("4634");
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.regexp.to-string.js
var es6_regexp_to_string = __webpack_require__("cc1d");
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js&
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/index.vue?vue&type=script&lang=js&
//
//
//
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
/* harmony default export */ var AliplayerV2vue_type_script_lang_js_ = ({
name: 'VueAliplayerV2',
props: {
options: {
@ -365,10 +365,6 @@ var es6_regexp_to_string = __webpack_require__("cc1d");
});
} else {
this.initPlayer(); //这样是为了兼容页面上有多个播放器
scriptTag.addEventListener("load", function () {
_this3.initPlayer();
});
}
},
@ -698,8 +694,8 @@ var es6_regexp_to_string = __webpack_require__("cc1d");
});
}
});
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/AliplayerV2/index.vue?vue&type=script&lang=js&
/* harmony default export */ var packages_AliplayerV2vue_type_script_lang_js_ = (AliplayerV2vue_type_script_lang_js_);
// CONCATENATED MODULE: ./node_modules/_vue-loader@15.7.2@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
@ -795,7 +791,7 @@ function normalizeComponent (
}
}
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue
// CONCATENATED MODULE: ./packages/AliplayerV2/index.vue
@ -804,7 +800,7 @@ function normalizeComponent (
/* normalize component */
var component = normalizeComponent(
src_mainvue_type_script_lang_js_,
packages_AliplayerV2vue_type_script_lang_js_,
render,
staticRenderFns,
false,
@ -814,44 +810,19 @@ var component = normalizeComponent(
)
/* harmony default export */ var main = (component.exports);
// CONCATENATED MODULE: ./packages/AliplayerV2/index.js
// 导入组件,组件必须声明 name
// 为组件添加 install 方法,用于按需引入
main.install = function (Vue) {
Vue.component(main.name, main);
};
/* harmony default export */ var AliplayerV2 = (main);
/* harmony default export */ var AliplayerV2 = (component.exports);
// CONCATENATED MODULE: ./packages/index.js
// packages / index.js
// 导入单个组件
// 以数组的结构保存组件,便于遍历
// 定义 install 方法
var components = [AliplayerV2]; // 定义 install 方法
var install = function install(Vue) {
if (install.installed) return false;
install.installed = true; // 遍历并注册全局组件
components.map(function (component) {
return Vue.component(component.name, component);
});
AliplayerV2.install = function (Vue) {
Vue.component(AliplayerV2.name, AliplayerV2);
};
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
/* harmony default export */ var packages_0 = ({
// 导出的对象必须具备一个 install 方法
install: install,
Player: AliplayerV2 // 组件列表
});
AliplayerV2.Player = AliplayerV2;
/* harmony default export */ var packages_0 = (AliplayerV2);
// CONCATENATED MODULE: ./node_modules/_@vue_cli-service@3.12.1@@vue/cli-service/lib/commands/build/entry-lib.js

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "vue-aliplayer-v2",
"version": "1.2.2",
"version": "1.2.3",
"author": "yxs",
"description": "感谢每一位开源的开发者. 这是一个基于Alipayer 开发并封装成vue组件的集成播放器.",
"main":"lib/vue-aliplayer-v2.umd.min.js",

View File

@ -1,7 +0,0 @@
// 导入组件,组件必须声明 name
import VueAliplayerV2 from './src/main.vue';
// 为组件添加 install 方法,用于按需引入
VueAliplayerV2.install = function (Vue) {
Vue.component(VueAliplayerV2.name, VueAliplayerV2);
}
export default VueAliplayerV2;

View File

@ -182,9 +182,6 @@ export default {
});
} else {
this.initPlayer(); //
scriptTag.addEventListener("load", () => {
this.initPlayer();
});
}
},

View File

@ -1,27 +1,9 @@
// packages / index.js
// 导入单个组件
import VueAliplayerV2 from './AliplayerV2';
// 以数组的结构保存组件,便于遍历
const components = [
VueAliplayerV2
];
// 定义 install 方法
const install = (Vue) =>{
if (install.installed) return false;
install.installed = true;
// 遍历并注册全局组件
components.map(component => {
return Vue.component(component.name, component)
});
};
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
export default {
// 导出的对象必须具备一个 install 方法
install,
Player: VueAliplayerV2
// 组件列表
VueAliplayerV2.install = (Vue) =>{
Vue.component(VueAliplayerV2.name, VueAliplayerV2)
};
VueAliplayerV2.Player = VueAliplayerV2;
export default VueAliplayerV2;

23
t.sh
View File

@ -1,3 +1,7 @@
echo "设置 npm config set registry http://registry.npmjs.org"
npm config set registry http://registry.npmjs.org
echo "打包 => dist";
# 打包 => dist
@ -13,6 +17,10 @@ echo "推送到npmjs";
#推送到npmjs
npm publish;
echo "设置 npm config set registry https://registry.npm.taobao.org"
npm config set registry https://registry.npm.taobao.org
# 更新gh-pages
echo "更新gh-pages";
@ -33,18 +41,3 @@ git push origin -d gh-pages;
git subtree push --prefix dist origin gh-pages;
echo "已推送gh-pages";
# 推送完成后切换回master
git checkout master;
echo "切换回master";
git add .;
git commit -m "更新lib包";
git pull;
git push;
echo "完成";