-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from TUS-OSK/slack
Slack
- Loading branch information
Showing
10 changed files
with
499 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ const Server = require('./server'); | |
const aws = require('./aws'); | ||
const Stream = require('./stream'); | ||
const { daemon } = require('./utils'); | ||
const slack = require('./slack'); | ||
|
||
const config = { | ||
restApiId: process.env.AWS_REST_API_ID, | ||
|
@@ -13,10 +14,13 @@ const config = { | |
ngrokToken: process.env.NGROK_TOKEN, | ||
slackClientId: process.env.SLACK_CLIENT_ID, | ||
slackClientSecret: process.env.SLACK_CLIENT_SECRET, | ||
slackBotAccessToken: process.env.SLACK_BOT_ACCESS_TOKEN, | ||
slackSigningSecret: process.env.SLACK_SIGNING_SECRET, | ||
contactChannel: process.env.CONTACT_CHANNEL, | ||
wsId: process.env.WORKSTATION_ID, | ||
privateKey: process.env.PRIVATE_KEY, | ||
debug: Boolean(process.env.DEBUG), | ||
isMac: Boolean(process.env.IS_MAC), | ||
debug: process.env.DEBUG && Boolean(JSON.parse(process.env.DEBUG)), | ||
isMac: process.env.IS_MAC && Boolean(JSON.parse(process.env.IS_MAC)), | ||
}; | ||
|
||
const liveServer = new RtmpServer(1935); | ||
|
@@ -36,14 +40,13 @@ disk | |
console.log(`Please put HLS files in ${mountPath}`); | ||
let input; | ||
if (config.isMac) { | ||
input = 'ffmpeg -f avfoundation -framerate 30 -re -i 0 -r 10'; | ||
input = 'ffmpeg -f avfoundation -re -i 0 -r 10'; | ||
} else { | ||
input = 'ffmpeg -i /dev/video0'; | ||
} | ||
daemon( | ||
`${input} -vcodec libx264 -pix_fmt yuv420p -preset veryfast -tune zerolatency,stillimage,film -vb 2500k -vf "drawtext=text='%{localtime}':[email protected]:x=0:y=h-lh*1.2:fontsize=24" -f flv rtmp://localhost:${1935}/live/bushitsuchan`, | ||
); | ||
|
||
daemon( | ||
`ffmpeg -i rtmp://localhost:1935/live/bushitsuchan -hls_flags delete_segments -g 40 -f hls ${mountPath}/output.m3u8`, | ||
); | ||
|
@@ -69,6 +72,16 @@ disk | |
config, | ||
`rtmp://localhost:1935/live/${'bushitsuchan'}`, | ||
); | ||
server.app.use( | ||
'/slack', | ||
slack( | ||
awsUrl, | ||
config.contactChannel, | ||
`rtmp://localhost:${1935}/live/bushitsuchan`, | ||
config.slackBotAccessToken, | ||
config.slackSigningSecret, | ||
), | ||
); | ||
server.run(3000).then(() => console.log(`Express app listening on port ${3000}`)); | ||
}) | ||
.catch((e) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
[ | ||
{ | ||
"type": "image", | ||
"title": { | ||
"type": "plain_text", | ||
"text": "部室の写真" | ||
}, | ||
"image_url": "${photo_image}", | ||
"alt_text": "部室の写真" | ||
}, | ||
{ | ||
"type": "actions", | ||
"block_id": "action_block", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "削除" | ||
}, | ||
"value": "delete", | ||
"action_id": "delete_button", | ||
"style": "danger", | ||
"confirm": { | ||
"title": { | ||
"type": "plain_text", | ||
"text": "メッセージ削除" | ||
}, | ||
"text": { | ||
"type": "plain_text", | ||
"text": "削除しますか?" | ||
}, | ||
"confirm": { | ||
"type": "plain_text", | ||
"text": "削除実行" | ||
}, | ||
"deny": { | ||
"type": "plain_text", | ||
"text": "キャンセル" | ||
} | ||
} | ||
} /** , | ||
{ | ||
"type": "overflow", | ||
"options": [ | ||
{ | ||
"text": { | ||
"type": "plain_text", | ||
"text": "slection1" | ||
}, | ||
"value": "slection1" | ||
}, | ||
{ | ||
"text": { | ||
"type": "plain_text", | ||
"text": "slection2" | ||
}, | ||
"value": "slection2" | ||
} | ||
], | ||
"action_id": "overflow" | ||
} */ | ||
] | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "${expired-time}" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
|
||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "📷 View photo with `/bushitsu-photo`" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "<${viewer-url}|WEB-配信動画版>" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "<${photo-viewer-url}|WEB-画像版>" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*問い合せ*: <#${contact-channel}>" | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.