Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shugo Kawamura committed Aug 15, 2020
1 parent 93789b5 commit 8d45462
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/sys v0.0.0-20200806125547-5acd03effb82 // indirect
Expand Down
2 changes: 2 additions & 0 deletions server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLD
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369 h1:Yp0zFEufLz0H7jzffb4UPXijavlyqlYeOg7dcyVUNnQ=
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369/go.mod h1:aFJ1ZwLjvHN4yEzE5Bkz8rD8/d8Vlj3UIuvz2yfET7I=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03/go.mod h1:Z9+Ul5bCbBKnbCvdOWbLqTHhJiYV414CURZJba6L8qA=
Expand Down
32 changes: 32 additions & 0 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"

"github.com/nareix/joy4/av/avutil"
"github.com/nareix/joy4/av/pubsub"
"github.com/nareix/joy4/format"
"github.com/nareix/joy4/format/rtmp"

vmixgo "github.com/FlowingSPDG/vmix-go"
)

Expand All @@ -26,6 +31,8 @@ var (
vmixaddr *string // Target vMix host address
vMixFunctions []vMixFunction // vMix functions slice. TODO!
vmix *vmixgo.Vmix

queue *pubsub.Queue
)

// GetvMixURLHandler returns vMix API Endpoint.
Expand Down Expand Up @@ -82,10 +89,35 @@ func init() {
vmixaddr = flag.String("vmix", "http://localhost:8088", "vMix API Address")
hostaddr = flag.String("host", ":8080", "Server listen port")
flag.Parse()

format.RegisterAll()
queue = pubsub.NewQueue()
}

func main() {
log.Println("STARTING...")

go func() {
RTMPServer := &rtmp.Server{
Addr: ":1935",
}

RTMPServer.HandlePlay = func(conn *rtmp.Conn) {
log.Println("RTMP Play request from:", conn.NetConn().RemoteAddr().String())
log.Println("URL :", *conn.URL)
avutil.CopyFile(conn, queue.Latest())
}

RTMPServer.HandlePublish = func(conn *rtmp.Conn) {
log.Println("RTMP Publish request from:", conn.NetConn().RemoteAddr().String())
log.Println("URL :", *conn.URL)
avutil.CopyFile(queue, conn)
}

log.Println("RTMP Server started")
log.Panicf("Failed to start RTMP Server : %v\n", RTMPServer.ListenAndServe())
}()

var err error
vmix, err = vmixgo.NewVmix(*vmixaddr)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link href="https://vjs.zencdn.net/7.1.0/video-js.min.css" rel="stylesheet">
<script src="https://vjs.zencdn.net/7.1.0/video.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-flash/2.1.1/videojs-flash.min.js"></script>

<title>vMix Management utility</title>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div id="nav">
<el-button round icon="el-icon-s-home" @click="JumpTo('/')">Home</el-button>
<el-button round icon="el-icon-s-operation" @click="JumpTo('/tree')">Input Menu</el-button>
<el-button round icon="el-icon-user-solid" @click="JumpTo('/program')">Program</el-button>
<el-button round icon="el-icon-user-solid" @click="JumpTo('/developer')">Developer</el-button>
<el-button round icon="el-icon-link" @click="moveLink('https://www.vmix.com/help23/index.htm?ShortcutFunctionReference.html')">vMix Reference</el-button>
</div>
Expand Down
6 changes: 6 additions & 0 deletions web/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Developer from '../views/Developer.vue'
import Tree from '../views/Tree.vue'
import Program from '../views/Program.vue'
import api from '../utils/api.vue'

Vue.use(VueRouter)
Expand All @@ -25,6 +26,11 @@ const routes = [
path: '/developer',
name: 'Developer',
component: Developer
},
{
path: '/program',
name: 'Program',
component: Program
}
]

Expand Down
21 changes: 21 additions & 0 deletions web/src/views/Program.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<div class="program">
<h1>Program Monitor(experimental)</h1>
<p>Playing RTMP Program from {{host}} </p>
<el-input v-model="StreamKey"></el-input>
<video id="rtmp_mytv_mytv" class="video-js vjs-default-skin" controls preload="auto" width="1280" height="720" data-setup='{}'>
<source :src="`rtmp://${host}:1935/${StreamKey}`" type='rtmp/mp4' />
</video>
</div>
</template>

<script>
export default {
data () {
return {
StreamKey:"vmu",
host: location.hostname
}
}
}
</script>
Loading

0 comments on commit 8d45462

Please sign in to comment.