Skip to content

Commit

Permalink
Update at 2023-02-17 18:44:58
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Feb 17, 2023
1 parent d0a4b24 commit 7da4f10
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
.history/

test.js
8 changes: 5 additions & 3 deletions dist/artplayer-plugin-playlist.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
if (!options.playlist[index]) {
return;
}

// 获取artplayer配置
var artOptions = art.option;
var newArtplayer = art;
Expand All @@ -40,7 +41,8 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
// 重建artplayer
newArtplayer = new Artplayer(_objectSpread(_objectSpread(_objectSpread({}, artOptions), options.playlist[index]), {}, {
autoplay: (_options$autoNext = options.autoNext) !== null && _options$autoNext !== void 0 ? _options$autoNext : artOptions.autoplay,
i18n: addedI18n
i18n: addedI18n,
id: "".concat(artOptions.id, "-").concat(index === 0 ? '' : index)
}));
} else {
art.switchUrl(options.playlist[index].url, options.playlist[index].title);
Expand All @@ -55,7 +57,7 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
}
};

// 自动播放下一集
// 自动播放下一P
var currentEp = options.playlist.findIndex(function (videoInfo) {
return videoInfo.url === art.option.url;
});
Expand All @@ -66,7 +68,7 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
}
var icon = '<i class="art-icon"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M810.666667 384H85.333333v85.333333h725.333334V384z m0-170.666667H85.333333v85.333334h725.333334v-85.333334zM85.333333 640h554.666667v-85.333333H85.333333v85.333333z m640-85.333333v256l213.333334-128-213.333334-128z" fill="#ffffff"></path></svg></i>';

// 添加播放列表
// 添加播放列表控件
art.controls.add({
name: 'playlist',
position: 'right',
Expand Down
8 changes: 5 additions & 3 deletions dist/artplayer-plugin-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
if (!options.playlist[index]) {
return;
}

// 获取artplayer配置
var artOptions = art.option;
var newArtplayer = art;
Expand All @@ -39,7 +40,8 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
// 重建artplayer
newArtplayer = new Artplayer(_objectSpread(_objectSpread(_objectSpread({}, artOptions), options.playlist[index]), {}, {
autoplay: (_options$autoNext = options.autoNext) !== null && _options$autoNext !== void 0 ? _options$autoNext : artOptions.autoplay,
i18n: addedI18n
i18n: addedI18n,
id: "".concat(artOptions.id, "-").concat(index === 0 ? '' : index)
}));
} else {
art.switchUrl(options.playlist[index].url, options.playlist[index].title);
Expand All @@ -54,7 +56,7 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
}
};

// 自动播放下一集
// 自动播放下一P
var currentEp = options.playlist.findIndex(function (videoInfo) {
return videoInfo.url === art.option.url;
});
Expand All @@ -65,7 +67,7 @@ var artplayerPlaylist = function artplayerPlaylist(options) {
}
var icon = '<i class="art-icon"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M810.666667 384H85.333333v85.333333h725.333334V384z m0-170.666667H85.333333v85.333334h725.333334v-85.333334zM85.333333 640h554.666667v-85.333333H85.333333v85.333333z m640-85.333333v256l213.333334-128-213.333334-128z" fill="#ffffff"></path></svg></i>';

// 添加播放列表
// 添加播放列表控件
art.controls.add({
name: 'playlist',
position: 'right',
Expand Down
2 changes: 1 addition & 1 deletion dist/artplayer-plugin-playlist.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "artplayer-playlist",
"version": "1.0.1",
"version": "1.0.2",
"description": "artplayer播放列表插件",
"main": "dist/artplayer-plugin-playlist.js",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions src/artplayer-plugin-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const artplayerPlaylist = (options) => (art) => {
if (!options.playlist[index]) {
return;
}

// 获取artplayer配置
const artOptions = art.option;

Expand All @@ -28,7 +29,8 @@ const artplayerPlaylist = (options) => (art) => {
...artOptions,
...options.playlist[index],
autoplay: options.autoNext ?? artOptions.autoplay,
i18n: addedI18n
i18n: addedI18n,
id: `${artOptions.id}-${index === 0 ? '' : index}`
});
} else {
art.switchUrl(options.playlist[index].url, options.playlist[index].title);
Expand All @@ -43,7 +45,7 @@ const artplayerPlaylist = (options) => (art) => {
}
};

// 自动播放下一集
// 自动播放下一P
const currentEp = options.playlist.findIndex((videoInfo) => videoInfo.url === art.option.url);
if (options.autoNext && currentEp < options.playlist.length) {
art.on('video:ended', () => {
Expand All @@ -53,7 +55,7 @@ const artplayerPlaylist = (options) => (art) => {

const icon = '<i class="art-icon"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M810.666667 384H85.333333v85.333333h725.333334V384z m0-170.666667H85.333333v85.333334h725.333334v-85.333334zM85.333333 640h554.666667v-85.333333H85.333333v85.333333z m640-85.333333v256l213.333334-128-213.333334-128z" fill="#ffffff"></path></svg></i>';

// 添加播放列表
// 添加播放列表控件
art.controls.add({
name: 'playlist',
position: 'right',
Expand Down

0 comments on commit 7da4f10

Please sign in to comment.