which folder should I put in for "pepflashplayer.dll"?
I clone the https://github.com/hokein/electron-sample-apps and copy "pepflashplayer.dll" to the folder where "main.js" in, it works. The electron-sample-apps code like this:
````
const {app, BrowserWindow} = require('electron');
const path = require('path');
let mainWindow;
app.on('window-all-closed', function() {
if (process.platform != 'darwin')
app.quit();
});
let pluginName
switch (process.platform) {
case 'win32':
pluginName = 'pepflashplayer.dll'
break
case 'darwin':
pluginName = 'PepperFlashPlayer.plugin'
break
case 'linux':
pluginName = 'libpepflashplayer.so'
break
}
app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName))
app.on('ready', function() {
mainWindow = new BrowserWindow({
'width': 800,
'height': 600,
'webPreferences': {'plugins': true}
});
mainWindow.loadURL('http://www.adobe.com/software/flash/about/');
});
````
And my electron-vue's main.js like this:
But it doesn't work
````
'use strict'
import { app, BrowserWindow } from 'electron'
const path = require('path')
// Specify flash path, supposing it is placed in the same directory with main.js.
let pluginName
switch (process.platform) {
case 'win32':
pluginName = 'pepflashplayer.dll'
break
case 'darwin':
pluginName = 'PepperFlashPlayer.plugin'
break
case 'linux':
pluginName = 'libpepflashplayer.so'
break
}
app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName))
/**
__static path to static files in productionlet mainWindow
const winURL = process.env.NODE_ENV === 'development'
? http://localhost:9080
: file://${__dirname}/index.html
function createWindow () {
/**
mainWindow.loadURL(winURL)
mainWindow.setMenu(null)
mainWindow.on('closed', () => {
mainWindow = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})
````
@wenpengfei
You would want to place the plugin files in the static/ directory and access them using the __static variable. So something like path.join(__static, pluginName) should work.
Related: https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html#use-case-within-js-with-fspath-and-static
It works! thanks~!
No problem.
Most helpful comment
@wenpengfei
You would want to place the plugin files in the
static/directory and access them using the__staticvariable. So something likepath.join(__static, pluginName)should work.Related: https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html#use-case-within-js-with-fspath-and-static