Переглянути джерело

完善客户要求前的一次提交

liuwei 4 роки тому
батько
коміт
cc999157c9
5 змінених файлів з 30 додано та 10 видалено
  1. 1 0
      package.json
  2. 2 0
      src/index.ejs
  3. 15 4
      src/main/index.js
  4. 6 6
      src/renderer/components/BigShow.vue
  5. 6 0
      static/vidoe_source.json

+ 1 - 0
package.json

@@ -54,6 +54,7 @@
   "dependencies": {
     "axios": "^0.19.2",
     "element-ui": "^2.13.0",
+    "express": "^4.17.1",
     "mux.js": "^5.6.2",
     "pubsub-js": "^1.7.0",
     "video.js": "^7.7.6",

+ 2 - 0
src/index.ejs

@@ -16,5 +16,7 @@
     <script>
       if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
     </script>
+    <!--<script src="https://cdn.bootcdn.net/ajax/libs/video.js/7.7.6/video.min.js"></script>
+    <script src="https://cdn.bootcdn.net/ajax/libs/videojs-flash/2.2.1/videojs-flash.min.js"></script>-->
   </body>
 </html>

+ 15 - 4
src/main/index.js

@@ -1,4 +1,5 @@
 import { app, BrowserWindow,screen } from 'electron'
+import express from "express"
 
 const electron = require('electron')
 const ipc = electron.ipcMain
@@ -12,10 +13,10 @@ if (process.env.NODE_ENV !== 'development') {
 }
 
 let mainWindow
-const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html`
+const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `http://localhost:8888/index.html`
 
 app.commandLine.appendSwitch('ppapi-flash-path',app.getPath('pepperFlashSystemPlugin'))
-app.commandLine.appendSwitch('ppapi-flash-version', '32.0.0.363')
+// app.commandLine.appendSwitch('ppapi-flash-version', '32.0.0.363')
 
 function createWindow () {
 
@@ -34,7 +35,7 @@ function createWindow () {
     autoHideMenuBar: true,
     webPreferences: {
       // 使用插件
-      'plugins': true,
+      plugins: true,
       // 允许跨域
       webSecurity: false,
       // 渲染进程是否使用node
@@ -59,8 +60,12 @@ function createWindow () {
   })
 
   mainWindow.on('closed', () => {
-    mainWindow = null
+      mainWindow = null
   })
+
+  if (process.env.NODE_ENV === "production") {
+      localServer()
+  }
 }
 
 app.on('ready', createWindow)
@@ -86,3 +91,9 @@ ipc.on('window-min',function(){
 ipc.on('window-close',function() {
   mainWindow.close()
 })
+
+function localServer() {
+  let server = express()
+  server.use(express.static(__dirname))
+  server.listen(8888)
+}

+ 6 - 6
src/renderer/components/BigShow.vue

@@ -30,7 +30,6 @@
             >
                 <div ref="signal">
                     <video-player
-                            class="videostyle"
                             :options="playerOptions"
                             :playsinline="true"
                     >
@@ -65,17 +64,16 @@
                 streamWindows:[], // 传递出去的信号源位置信息
                 bigScreenJson:[],
                 playerOptions: {
-                    sources: [{
-                        type: "rtmp/flv",
-                        src: "rtmp://58.200.131.2:1935/livetv/hunantv"
-                    }],
+                    sources: [],
                     techOrder: ['flash'],
                     autoplay: true,
                     controls: true,
+                    /*flash: {
+                        swf: "static/video-js.swf"
+                    },*/
                     fluid:true,
                     preload: 'auto',
                     notSupportedMessage: '此视频暂无法播放,请稍后再试',
-                    width: document.documentElement.clientWidth,
                 }
             }
         },
@@ -88,6 +86,8 @@
 
         async beforeCreate() {
             this.bigScreenJson = await getStaticFile('EnityBigScreen.Data')
+            this.videoSourceJson = await getStaticFile('vidoe_source.json')
+            this.$set(this.playerOptions,'sources',this.videoSourceJson)
         },
 
         methods: {

+ 6 - 0
static/vidoe_source.json

@@ -0,0 +1,6 @@
+[
+  {
+      "src": "rtmp://58.200.131.2:1935/livetv/hunantv",
+      "type": "rtmp/flv"
+  }
+]