Advertisement
Guest User

OMXAttempt

a guest
Jun 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. // Modules to control application life and create native browser window
  2. const {app, BrowserWindow} = require('electron')
  3. const path = require('path')
  4.  
  5. // Keep a global reference of the window object, if you don't, the window will
  6. // be closed automatically when the JavaScript object is garbage collected.
  7. let mainWindow
  8.  
  9. var OmxManager = require('omx-manager');
  10. var manager = new OmxManager(); // OmxManager
  11. var camera = manager.create('video_file.mkv'); // OmxInstance
  12. manager.setVideosDirectory('./resources/video_file.mkv');
  13. camera.play(); // Will start the process to play videos
  14.  
  15. function createWindow () {
  16. // Create the browser window.
  17. mainWindow = new BrowserWindow({
  18. width: 800,
  19. height: 600,
  20. webPreferences: {
  21. preload: path.join(__dirname, 'preload.js')
  22. }
  23. })
  24.  
  25. // and load the index.html of the app.
  26. mainWindow.loadFile('index.html')
  27.  
  28. // Open the DevTools.
  29. // mainWindow.webContents.openDevTools()
  30.  
  31. // Emitted when the window is closed.
  32. mainWindow.on('closed', function () {
  33. // Dereference the window object, usually you would store windows
  34. // in an array if your app supports multi windows, this is the time
  35. // when you should delete the corresponding element.
  36. mainWindow = null
  37. })
  38. }
  39.  
  40. // This method will be called when Electron has finished
  41. // initialization and is ready to create browser windows.
  42. // Some APIs can only be used after this event occurs.
  43. app.on('ready', createWindow)
  44.  
  45. // Quit when all windows are closed.
  46. app.on('window-all-closed', function () {
  47. // On macOS it is common for applications and their menu bar
  48. // to stay active until the user quits explicitly with Cmd + Q
  49. if (process.platform !== 'darwin') app.quit()
  50. })
  51.  
  52. app.on('activate', function () {
  53. // On macOS it's common to re-create a window in the app when the
  54. // dock icon is clicked and there are no other windows open.
  55. if (mainWindow === null) createWindow()
  56. })
  57.  
  58. // In this file you can include the rest of your app's specific main process
  59. // code. You can also put them in separate files and require them here.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement