Add script to verify ffmpeg without proprietary codecs

This commit is contained in:
Kevin Sawicki 2017-03-29 16:23:30 -07:00
parent 740de02d6c
commit 6b8f840da0
3 changed files with 112 additions and 0 deletions

36
spec/fixtures/no-proprietary-codecs.js vendored Normal file
View file

@ -0,0 +1,36 @@
const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
const url = require('url')
const MEDIA_ERR_SRC_NOT_SUPPORTED = 4
let window
app.once('ready', () => {
window = new BrowserWindow({
show: false
})
window.loadURL(url.format({
protocol: 'file',
slashed: true,
pathname: path.resolve(__dirname, 'asar', 'video.asar', 'index.html')
}))
ipcMain.on('asar-video', function (event, message, error) {
if (message === 'ended') {
console.log('Video played, proprietary codecs are included')
app.exit(1)
return
}
if (message === 'error' && error === MEDIA_ERR_SRC_NOT_SUPPORTED) {
console.log('Video format not supported, proprietary codecs are not included')
app.exit(0)
return
}
console.log(`Unexpected error: ${error}`)
app.exit(1)
})
})