chromecast (very botchy)
This commit is contained in:
parent
9e52541ecf
commit
c893304b5d
9 changed files with 483 additions and 19 deletions
|
@ -9,11 +9,13 @@ var CiderAudio = {
|
|||
vibrantbassNode: null,
|
||||
llpw: null,
|
||||
llpwEnabled: null,
|
||||
analogWarmth: null
|
||||
analogWarmth: null,
|
||||
},
|
||||
ccON: false,
|
||||
mediaRecorder: null,
|
||||
init: function (cb = function () { }) {
|
||||
//AudioOutputs.fInit = true;
|
||||
searchInt = setInterval(function () {
|
||||
let searchInt = setInterval(function () {
|
||||
if (document.getElementById("apple-music-player")) {
|
||||
//AudioOutputs.eqReady = true;
|
||||
document.getElementById("apple-music-player").crossOrigin = "anonymous";
|
||||
|
@ -138,19 +140,29 @@ var CiderAudio = {
|
|||
CiderAudio.hierarchical_loading();
|
||||
},
|
||||
sendAudio: function (){
|
||||
var options = {
|
||||
mimeType : 'audio/webm; codecs=opus'
|
||||
};
|
||||
var destnode = CiderAudio.context.createMediaStreamDestination();
|
||||
CiderAudio.audioNodes.gainNode.connect(destnode)
|
||||
var mediaRecorder = new MediaRecorder(destnode.stream,options);
|
||||
mediaRecorder.start(1);
|
||||
mediaRecorder.ondataavailable = function(e) {
|
||||
e.data.arrayBuffer().then(buffer => {
|
||||
ipcRenderer.send('writeAudio',buffer)
|
||||
}
|
||||
);
|
||||
if (!CiderAudio.ccON) {
|
||||
CiderAudio.ccON = true
|
||||
let searchInt = setInterval(function () {
|
||||
if (CiderAudio.context != null && CiderAudio.audioNodes.gainNode != null) {
|
||||
var options = {
|
||||
mimeType: 'audio/webm; codecs=opus'
|
||||
};
|
||||
var destnode = CiderAudio.context.createMediaStreamDestination();
|
||||
CiderAudio.audioNodes.gainNode.connect(destnode)
|
||||
var mediaRecorder = new MediaRecorder(destnode.stream, options);
|
||||
mediaRecorder.start(1);
|
||||
mediaRecorder.ondataavailable = function (e) {
|
||||
e.data.arrayBuffer().then(buffer => {
|
||||
ipcRenderer.send('writeAudio', buffer)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
clearInterval(searchInt);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
},
|
||||
analogWarmth_h2_3: function (status, hierarchy){
|
||||
if (status === true) { // 23 Band Adjustment
|
||||
|
|
|
@ -253,6 +253,7 @@ const app = new Vue({
|
|||
pluginMenu: false,
|
||||
audioControls: false,
|
||||
showPlaylist: false,
|
||||
castMenu: false
|
||||
},
|
||||
socialBadges: {
|
||||
badgeMap: {},
|
||||
|
@ -269,7 +270,8 @@ const app = new Vue({
|
|||
headerItems: {}
|
||||
}
|
||||
},
|
||||
pauseButtonTimer: null
|
||||
pauseButtonTimer: null,
|
||||
activeCasts: []
|
||||
},
|
||||
watch: {
|
||||
cfg: {
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
<transition name="modal">
|
||||
<audio-settings v-if="modals.audioSettings"></audio-settings>
|
||||
</transition>
|
||||
<transition name="modal">
|
||||
<castmenu v-if="modals.castMenu"></castmenu>
|
||||
</transition>
|
||||
<transition name="modal">
|
||||
<plugin-menu v-if="modals.pluginMenu"></plugin-menu>
|
||||
</transition>
|
||||
|
|
|
@ -96,6 +96,10 @@
|
|||
<span class="usermenu-item-icon"><%- include("../svg/smartphone.svg") %></span>
|
||||
<span class="usermenu-item-name">{{$root.getLz('action.showWebRemoteQR')}}</span>
|
||||
</button>
|
||||
<button class="usermenu-item" @click="modals.castMenu = true">
|
||||
<span class="usermenu-item-icon"><%- include("../svg/cast.svg") %></span>
|
||||
<span class="usermenu-item-name">Cast</span>
|
||||
</button>
|
||||
<button class="usermenu-item" v-if="cfg.advanced.AudioContext"
|
||||
@click="modals.audioSettings = true">
|
||||
<span class="usermenu-item-icon"><%- include("../svg/headphones.svg") %></span>
|
||||
|
|
106
src/renderer/views/components/castmenu.ejs
Normal file
106
src/renderer/views/components/castmenu.ejs
Normal file
|
@ -0,0 +1,106 @@
|
|||
<script type="text/x-template" id="castmenu">
|
||||
<div class="spatialproperties-panel castmenu modal-fullscreen" >
|
||||
<div class="modal-window">
|
||||
<div class="modal-header">
|
||||
<div class="modal-title">Cast To Devices</div>
|
||||
<button class="close-btn" @click="close()"></button>
|
||||
</div>
|
||||
<div class="modal-content" style="overflow-y: overlay; padding: 3%">
|
||||
<div class="md-labeltext">Chromecast</div>
|
||||
<div class="md-option-container" style="margin-top: 12px;margin-bottom: 12px;">
|
||||
<template v-if="!scanning">
|
||||
<template v-for="(device) in devices.cast">
|
||||
<div class="md-option-line" style="cursor: pointer" @click="setCast(device)">
|
||||
<div class="md-option-segment">
|
||||
{{ device.name }}
|
||||
<br>
|
||||
<small>{{ device.host }}</small>
|
||||
</div>
|
||||
<div class="md-option-segment_auto" style="display: flex;justify-content: center;align-items: center" v-if="activeCasts.includes(device)">
|
||||
Connected
|
||||
</div>
|
||||
<div class="md-option-segment_auto" v-else style="display: flex;justify-content: center;align-items: center">
|
||||
<svg width="20" height="20" viewBox="0 0 34 34" fill="#fff" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" class="castPlayIndicator"><path d="M28.228,18.327l-16.023,8.983c-0.99,0.555 -2.205,-0.17 -2.205,-1.318l0,-17.984c0,-1.146 1.215,-1.873 2.205,-1.317l16.023,8.982c1.029,0.577 1.029,2.077 0,2.654Z" style="fill-rule:nonzero"></path></svg>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="md-option-line" style="cursor: pointer">
|
||||
<div class="md-option-segment">
|
||||
Scanning...
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="md-labeltext" style="opacity:0.5;">AirPlay</div>
|
||||
<div class="md-option-container" style="margin-top: 12px;margin-bottom: 12px;opacity:0.5;">
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
AirPlay is still under development
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-footer">
|
||||
<div class="row">
|
||||
<div class="col" v-if="activeCasts.length != 0">
|
||||
<button style="width:100%" @click="stopCasting()" class="md-btn md-btn-block md-btn-primary">Stop casting to all devices</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button style="width:100%" class="md-btn md-btn-block" @click="scan()">Scan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
Vue.component('castmenu', {
|
||||
template: '#castmenu',
|
||||
data: function () {
|
||||
return {
|
||||
devices: {
|
||||
cast: [],
|
||||
airplay: []
|
||||
},
|
||||
scanning: false,
|
||||
activeCasts: this.$root.activeCasts,
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.scan();
|
||||
},
|
||||
watch:{
|
||||
activeCasts: function (newVal, oldVal) {
|
||||
this.$root.activeCasts = this.activeCasts;
|
||||
}},
|
||||
methods: {
|
||||
close() {
|
||||
this.$root.modals.castMenu = false
|
||||
},
|
||||
scan() {
|
||||
let self = this;
|
||||
this.scanning = true;
|
||||
ipcRenderer.send('getChromeCastDevices', '');
|
||||
setTimeout(() => {
|
||||
self.devices.cast = ipcRenderer.sendSync("getKnownCastDevices");
|
||||
self.scanning = false;
|
||||
}, 2000);
|
||||
console.log(this.devices);
|
||||
// vm.$forceUpdate();
|
||||
},
|
||||
setCast(device) {
|
||||
CiderAudio.sendAudio();
|
||||
this.activeCasts.push(device);
|
||||
ipcRenderer.send('performGCCast', device, "Cider", "Playing ...", "Test build", '');
|
||||
},
|
||||
stopCasting() {
|
||||
ipcRenderer.send('stopGCast', '');
|
||||
this.activeCasts = [];
|
||||
// vm.$forceUpdate();
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -1,4 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 22" version="1.1" fill="#fff"
|
||||
style="width: 100%; height: 100%; fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 1.41421">
|
||||
<path d="M16.811,12.75c0.245,-0.355 0.389,-0.786 0.389,-1.25c0,-1.215 -0.985,-2.2 -2.2,-2.2c-1.215,0 -2.2,0.985 -2.2,2.2c0,0.466 0.145,0.898 0.392,1.254l-0.83,1.047c-0.537,-0.616 -0.862,-1.42 -0.862,-2.301c0,-1.933 1.567,-3.5 3.5,-3.5c1.933,0 3.5,1.567 3.5,3.5c0,0.879 -0.324,1.683 -0.859,2.297l-0.83,-1.047Zm1.271,1.604c0.694,-0.749 1.118,-1.752 1.118,-2.854c0,-2.32 -1.88,-4.2 -4.2,-4.2c-2.32,0 -4.2,1.88 -4.2,4.2c0,1.103 0.425,2.107 1.121,2.857l-0.814,1.028c-0.993,-0.995 -1.607,-2.368 -1.607,-3.885c0,-3.038 2.462,-5.5 5.5,-5.5c3.038,0 5.5,2.462 5.5,5.5c0,1.515 -0.613,2.887 -1.604,3.882l-0.814,-1.028Zm1.252,1.58c1.151,-1.126 1.866,-2.697 1.866,-4.434c0,-3.424 -2.776,-6.2 -6.2,-6.2c-3.424,0 -6.2,2.776 -6.2,6.2c0,1.739 0.716,3.311 1.869,4.437l-0.811,1.023c-1.452,-1.368 -2.358,-3.308 -2.358,-5.46c0,-4.142 3.358,-7.5 7.5,-7.5c4.142,0 7.5,3.358 7.5,7.5c0,2.15 -0.905,4.089 -2.355,5.457l-0.811,-1.023Zm-0.227,2.066l-8.219,0c-0.355,0 -0.515,-0.434 -0.27,-0.717l4.058,-5.12c0.178,-0.217 0.474,-0.217 0.652,0l4.058,5.12c0.237,0.283 0.085,0.717 -0.279,0.717Z" style="fill-rule:nonzero"></path>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cast"><path d="M2 16.1A5 5 0 0 1 5.9 20M2 12.05A9 9 0 0 1 9.95 20M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6"/><line x1="2" y1="20" x2="2.01" y2="20"/></svg>
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 375 B |
Loading…
Add table
Add a link
Reference in a new issue