Compare commits

..

1 Commits

Author SHA1 Message Date
langhuihui
73941d1e0b ADTS转RTMP协议方式传输音频包 2020-02-18 15:19:21 +08:00
11 changed files with 33 additions and 21 deletions

View File

@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>Monibuca</title><script src=jessibuca/ajax.js></script><script src=jessibuca/renderer.js></script><link href=/css/app.ce470878.css rel=preload as=style><link href=/css/chunk-vendors.22ebf426.css rel=preload as=style><link href=/js/app.017fb959.js rel=preload as=script><link href=/js/chunk-vendors.ebc28a73.js rel=preload as=script><link href=/css/chunk-vendors.22ebf426.css rel=stylesheet><link href=/css/app.ce470878.css rel=stylesheet></head><body><noscript><strong>We're sorry but dashboard doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ebc28a73.js></script><script src=/js/app.017fb959.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>Monibuca</title><script src=jessibuca/ajax.js></script><script src=jessibuca/renderer.js></script><link href=/css/app.ce470878.css rel=preload as=style><link href=/css/chunk-vendors.22ebf426.css rel=preload as=style><link href=/js/app.16c0d7c9.js rel=preload as=script><link href=/js/chunk-vendors.ebc28a73.js rel=preload as=script><link href=/css/chunk-vendors.22ebf426.css rel=stylesheet><link href=/css/app.ce470878.css rel=stylesheet></head><body><noscript><strong>We're sorry but dashboard doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ebc28a73.js></script><script src=/js/app.16c0d7c9.js></script></body></html>

View File

@@ -1,4 +1,6 @@
window.AudioContext = window.AudioContext || window.webkitAudioContext;
function Jessibuca(opt) {
this.audioContext = new window.AudioContext()
this.canvasElement = opt.canvas;
this.contextOptions = opt.contextOptions;
this.videoBuffer = opt.videoBuffer || 1
@@ -65,9 +67,7 @@ function Jessibuca(opt) {
}
}
};
window.AudioContext = window.AudioContext || window.webkitAudioContext;
function _unlock() {
var context = Jessibuca.prototype.audioContext = Jessibuca.prototype.audioContext || new window.AudioContext();
function _unlock(context) {
context.resume();
var source = context.createBufferSource();
source.buffer = context.createBuffer(1, 1, 22050);
@@ -81,7 +81,7 @@ function _unlock() {
// document.addEventListener("touchend", _unlock, true);
Jessibuca.prototype.audioEnabled = function (flag) {
if (flag) {
_unlock()
_unlock(this.audioContext)
this.audioEnabled = function (flag) {
if (flag) {
this.audioContext.resume();
@@ -452,6 +452,7 @@ Jessibuca.prototype.close = function () {
if (this.audioInterval) {
clearInterval(this.audioInterval)
}
delete this.playAudio
this.decoderWorker.postMessage({ cmd: "close" })
this.contextGL.clear(this.contextGL.COLOR_BUFFER_BIT);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dashboard/dist/js/app.16c0d7c9.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dashboard/dist/js/app.16c0d7c9.js.map vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,6 @@
window.AudioContext = window.AudioContext || window.webkitAudioContext;
function Jessibuca(opt) {
this.audioContext = new window.AudioContext()
this.canvasElement = opt.canvas;
this.contextOptions = opt.contextOptions;
this.videoBuffer = opt.videoBuffer || 1
@@ -65,9 +67,7 @@ function Jessibuca(opt) {
}
}
};
window.AudioContext = window.AudioContext || window.webkitAudioContext;
function _unlock() {
var context = Jessibuca.prototype.audioContext = Jessibuca.prototype.audioContext || new window.AudioContext();
function _unlock(context) {
context.resume();
var source = context.createBufferSource();
source.buffer = context.createBuffer(1, 1, 22050);
@@ -81,7 +81,7 @@ function _unlock() {
// document.addEventListener("touchend", _unlock, true);
Jessibuca.prototype.audioEnabled = function (flag) {
if (flag) {
_unlock()
_unlock(this.audioContext)
this.audioEnabled = function (flag) {
if (flag) {
this.audioContext.resume();
@@ -452,6 +452,7 @@ Jessibuca.prototype.close = function () {
if (this.audioInterval) {
clearInterval(this.audioInterval)
}
delete this.playAudio
this.decoderWorker.postMessage({ cmd: "close" })
this.contextGL.clear(this.contextGL.COLOR_BUFFER_BIT);
}

View File

@@ -9,8 +9,8 @@
>
<canvas id="canvas" width="488" height="275" style="background: black" />
<div slot="footer">
音频缓冲
<InputNumber v-model="audioBuffer" size="small"></InputNumber>
<!-- 音频缓冲-->
<!-- <InputNumber v-model="audioBuffer" size="small"></InputNumber>-->
<Button v-if="audioEnabled" @click="turnOff" icon="md-volume-off" />
<Button v-else @click="turnOn" icon="md-volume-up"></Button>
</div>
@@ -24,7 +24,7 @@ export default {
data() {
return {
audioEnabled: false,
audioBuffer: 12,
// audioBuffer: 12,
url: ""
};
},
@@ -32,9 +32,9 @@ export default {
audioEnabled(value) {
h5lc.audioEnabled(value);
},
audioBuffer(v) {
h5lc.audioBuffer = v;
}
// audioBuffer(v) {
// h5lc.audioBuffer = v;
// }
},
mounted() {
h5lc = new window.Jessibuca({

12
main.go
View File

@@ -90,6 +90,9 @@ func importInstance(w http.ResponseWriter, r *http.Request) {
}()
name := r.URL.Query().Get("name")
if importPath := r.URL.Query().Get("path"); importPath != "" {
if strings.HasSuffix(importPath, "/") {
importPath = importPath[:len(importPath)-1]
}
f, err := os.Open(importPath)
if e = err; err != nil {
return
@@ -134,6 +137,13 @@ func importInstance(w http.ResponseWriter, r *http.Request) {
for _, m := range reg.FindAllStringSubmatch(string(mainGo), -1) {
instances[name].Plugins = append(instances[name].Plugins, m[1])
}
var file *os.File
file, e = os.OpenFile(path.Join(instancesDir, name+".toml"), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
if err != nil {
return
}
tomlEncoder := toml.NewEncoder(file)
e = tomlEncoder.Encode(instances[name])
} else {
e = errors.New("路径中缺少文件")
}
@@ -318,7 +328,7 @@ func main(){
}
sse.WriteEvent("step", []byte("5:go build 成功!"))
build.Reset()
build.WriteString("kill -9 `cat pid`\nnohup ./")
build.WriteString("kill -9 `cat pid`\n ./")
binFile := strings.TrimSuffix(p.Path, "/")
_, binFile = path.Split(binFile)
build.WriteString(binFile)

View File

@@ -38,7 +38,7 @@ func (av *AVPacket) ADTS2ASC() (tagPacket *AVPacket) {
tagPacket = NewAVPacket(FLV_TAG_TYPE_AUDIO)
tagPacket.Payload = ADTSToAudioSpecificConfig(av.Payload)
tagPacket.IsAACSequence = true
ADTSLength := 7 + (int(av.Payload[1]&1) << 1)
ADTSLength := 7 + ((1 - int(av.Payload[1]&1)) << 1)
if len(av.Payload) > ADTSLength {
av.Payload[0] = 0xAF
av.Payload[1] = 0x01 //raw AAC

View File

@@ -10,7 +10,7 @@ import (
)
var ConfigRaw []byte
var Version = "0.2.6"
var Version = "0.2.8"
var EngineInfo = &struct {
Version string
StartTime time.Time