Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
✨ 默认转码最高画质
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Mar 31, 2021
1 parent 126a17b commit 758a2c7
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 419 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DS_Store
node_modules
# /dist
/dist


# local env files
Expand Down
Binary file removed dist/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion dist/index.html

This file was deleted.

1 change: 0 additions & 1 deletion dist/static/css/about.f0b54b1c.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/static/css/app.f3c599b4.css

This file was deleted.

17 changes: 0 additions & 17 deletions dist/static/css/chunk-vendors.8f913079.css

This file was deleted.

Binary file removed dist/static/img/alist.bcb68ba0.png
Binary file not shown.
1 change: 0 additions & 1 deletion dist/static/js/about.8108f65b.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/static/js/app.8dd10106.js

This file was deleted.

298 changes: 0 additions & 298 deletions dist/static/js/chunk-vendors.131f0f41.js

This file was deleted.

7 changes: 1 addition & 6 deletions src/components/Path.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineComponent({
const routes = computed(() => {
const paths = route.params.path as string[]
if(!paths){
return[]
return[{path: '/', breadcrumbName: 'home'}]
}
const res: Route[] = paths.map(item => {
return{
Expand All @@ -60,11 +60,6 @@ export default defineComponent({
}
})||[]
res[0].children = roots
// res.unshift({
// path: '',
// breadcrumbName: 'root',
// children: roots
// })
return res
})
return {
Expand Down
160 changes: 68 additions & 92 deletions src/components/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,72 @@ export default defineComponent({
spinning: false,
});
let dp,ap
const videoTranscoding = ref<boolean>(true);
const switchVideoTrans = async () => {
if(dp){
dp.destroy()
}
if(!videoTranscoding.value) {
const {data} = await getPost(decodeURI(route.path.substring(1)),store.state.password)
const ex = file.value.file_extension
let type = 'auto'
if(ex==='flv'){
type = 'flv'
}
const videoOptions: DPlayerOptions={
container: document.getElementById('video-preview'),
video:{
url: data.data.url,
type: type
},
pluginOptions: {
flv: {
config: {
referrerPolicy: 'no-referrer'
}
}
},
autoplay:info.value.autoplay?true:false,
screenshot:true,
}
dp=new DPlayer(videoOptions)
}else{
videoPreviewPost(store.state.drive, file.value.file_id).then(resp => {
const res = resp.data
if (res.meta.code === 200) {
const videoOptions: DPlayerOptions={
container: document.getElementById('video-preview'),
video:{
url:'',
quality: res.data.template_list.map(item => {
return{
name: item.template_id,
url: item.url,
type: 'auto'
}
}),
defaultQuality: res.data.template_list.length-1,
},
pluginOptions: {
flv: {
config: {
referrerPolicy: 'no-referrer'
}
}
},
autoplay:info.value.autoplay?true:false,
// screenshot:true,
}
dp=new DPlayer(videoOptions)
} else {
message.error(res.meta.msg)
}
})
}
}
watch(videoTranscoding, async () => {
switchVideoTrans()
})
const audios = computed(() => store.state.audios)
const text = ref<string>('')
const showDoc = (file: FileProps) => {
Expand Down Expand Up @@ -144,33 +210,8 @@ export default defineComponent({
}
if (file.category==='video') {
// 预览视频
const {data} = await getPost(decodeURI(route.path.substring(1)),store.state.password)
previewShow.value.video=true
const ex = file.file_extension
let type = 'auto'
if(ex==='flv'){
type = 'flv'
}
// if(ex==='ts'){
// type = 'hls'
// }
const videoOptions: DPlayerOptions={
container: document.getElementById('video-preview'),
video:{
url: data.data.url,
type: type
},
pluginOptions: {
flv: {
config: {
referrerPolicy: 'no-referrer'
}
}
},
autoplay:info.value.autoplay?true:false,
screenshot:true,
}
dp=new DPlayer(videoOptions)
switchVideoTrans()
return
}
if (file.category ==='audio') {
Expand Down Expand Up @@ -224,72 +265,7 @@ export default defineComponent({
dp.destroy()
}
})
const videoTranscoding = ref<boolean>(false);
watch(videoTranscoding, async () => {
if(dp){
dp.destroy()
}
if(!videoTranscoding.value) {
const {data} = await getPost(decodeURI(route.path.substring(1)),store.state.password)
const ex = file.value.file_extension
let type = 'auto'
if(ex==='flv'){
type = 'flv'
}
// if(ex==='ts'){
// type = 'hls'
// }
const videoOptions: DPlayerOptions={
container: document.getElementById('video-preview'),
video:{
url: data.data.url,
type: type
},
pluginOptions: {
flv: {
config: {
referrerPolicy: 'no-referrer'
}
}
},
autoplay:info.value.autoplay?true:false,
screenshot:true,
}
dp=new DPlayer(videoOptions)
}else{
videoPreviewPost(store.state.drive, file.value.file_id).then(resp => {
const res = resp.data
if (res.meta.code === 200) {
const videoOptions: DPlayerOptions={
container: document.getElementById('video-preview'),
video:{
url:'',
quality: res.data.template_list.map(item => {
return{
name: item.template_id,
url: item.url,
type: 'auto'
}
}),
defaultQuality: 0,
},
pluginOptions: {
flv: {
config: {
referrerPolicy: 'no-referrer'
}
}
},
autoplay:info.value.autoplay?true:false,
// screenshot:true,
}
dp=new DPlayer(videoOptions)
} else {
message.error(res.meta.msg)
}
})
}
})
return {
file,
previewSpinning,
Expand Down

1 comment on commit 758a2c7

@vercel
Copy link

@vercel vercel bot commented on 758a2c7 Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

alist-web – ./

alist-web-git-main-xhofe.vercel.app
alist.nn.ci
alist.now.sh
alist-web-xhofe.vercel.app

Please sign in to comment.