File tree Expand file tree Collapse file tree 2 files changed +438
-5
lines changed
packages/xgplayer/src/plugins/download Expand file tree Collapse file tree 2 files changed +438
-5
lines changed Original file line number Diff line number Diff line change 1- import downloadUtil from 'downloadjs'
21import { POSITIONS , Util } from '../../plugin'
3- import { xgIconTips } from '../common/iconTools'
4- import IconPlugin from '../common/iconPlugin'
52import DownloadSvg from '../assets/download.svg'
3+ import IconPlugin from '../common/iconPlugin'
4+ import { xgIconTips } from '../common/iconTools'
5+ import { saveAsWithAuth } from './saveAs'
6+
67import './index.scss'
8+
79/**
810 * @typedef { {
911 * position: string,
1012 * index: number,
1113 * disable: boolean,
14+ * saveAsOptions: import('./saveAs').SaveAsOptions,
1215 * [propName: string]: any
1316 * } } IDownloadConfig
1417 */
@@ -24,7 +27,10 @@ export default class Download extends IconPlugin {
2427 return {
2528 position : POSITIONS . CONTROLS_RIGHT ,
2629 index : 3 ,
27- disable : true
30+ disable : true ,
31+ saveAsOptions : {
32+ withCredentials : true
33+ }
2834 }
2935 }
3036
@@ -67,7 +73,7 @@ export default class Download extends IconPlugin {
6773 dUrl = url [ 0 ] . src
6874 }
6975 const newUrl = this . getAbsoluteURL ( dUrl )
70- downloadUtil ( newUrl )
76+ saveAsWithAuth ( newUrl , Object . assign ( { } , this . config . saveAsOptions ) )
7177 this . isLock = true
7278 this . timer = window . setTimeout ( ( ) => {
7379 this . isLock = false
You can’t perform that action at this time.
0 commit comments