Fix watching video in development (#1668)
* Fix watching watched video in development * Fix removing a file even when it does not exist (and would raise error) * Fix infinite reload in video watching File updates (e.g. dashFiles) in static folder triggers app reload (web-dev-server) But the a file is created/updated/deleted on before playing any video So it goes into a loop of loading a video
This commit is contained in:
parent
b1a310ef09
commit
07fd93d3aa
|
@ -116,7 +116,12 @@ function startRenderer(callback) {
|
||||||
})
|
})
|
||||||
|
|
||||||
const server = new WebpackDevServer(compiler, {
|
const server = new WebpackDevServer(compiler, {
|
||||||
static: path.join(process.cwd(), 'static'),
|
static: {
|
||||||
|
directory: path.join(process.cwd(), 'static'),
|
||||||
|
watch: {
|
||||||
|
ignored: /(dashFiles|storyboards)\/*/
|
||||||
|
}
|
||||||
|
},
|
||||||
port
|
port
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -960,13 +960,13 @@ export default Vue.extend({
|
||||||
if (this.removeVideoMetaFiles) {
|
if (this.removeVideoMetaFiles) {
|
||||||
const userData = await this.getUserDataPath()
|
const userData = await this.getUserDataPath()
|
||||||
if (this.isDev) {
|
if (this.isDev) {
|
||||||
const dashFileLocation = `dashFiles/${this.videoId}.xml`
|
const dashFileLocation = `static/dashFiles/${this.videoId}.xml`
|
||||||
const vttFileLocation = `storyboards/${this.videoId}.vtt`
|
const vttFileLocation = `static/storyboards/${this.videoId}.vtt`
|
||||||
// only delete the file it actually exists
|
// only delete the file it actually exists
|
||||||
if (fs.existsSync('dashFiles/') && fs.existsSync(dashFileLocation)) {
|
if (fs.existsSync('static/dashFiles/') && fs.existsSync(dashFileLocation)) {
|
||||||
fs.rmSync(dashFileLocation)
|
fs.rmSync(dashFileLocation)
|
||||||
}
|
}
|
||||||
if (fs.existsSync('storyboards/') && fs.existsSync(vttFileLocation)) {
|
if (fs.existsSync('static/storyboards/') && fs.existsSync(vttFileLocation)) {
|
||||||
fs.rmSync(vttFileLocation)
|
fs.rmSync(vttFileLocation)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1014,9 +1014,10 @@ export default Vue.extend({
|
||||||
fs.mkdirSync('static/dashFiles/')
|
fs.mkdirSync('static/dashFiles/')
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.rm(fileLocation, () => {
|
if (fs.existsSync(fileLocation)) {
|
||||||
fs.writeFileSync(fileLocation, xmlData)
|
fs.rmSync(fileLocation)
|
||||||
})
|
}
|
||||||
|
fs.writeFileSync(fileLocation, xmlData)
|
||||||
} else {
|
} else {
|
||||||
fileLocation = `${userData}/dashFiles/${this.videoId}.xml`
|
fileLocation = `${userData}/dashFiles/${this.videoId}.xml`
|
||||||
uriSchema = `file://${fileLocation}`
|
uriSchema = `file://${fileLocation}`
|
||||||
|
|
Loading…
Reference in New Issue