ffmpeg当我捕捉屏幕时,我想录制音频.我在使用时遇到的错误alsa是我的图像没有声卡-f alsa -ac 2 -i hw:0
以下是如何在新版本的Ubuntu上重现
在新的ubuntu docker镜像中启动会话.
docker pull ubuntu
docker run -it --rm ubuntu
Run Code Online (Sandbox Code Playgroud)
安装alsa(高级Linux声音架构)
apt-get update
apt-get install alsa-utils
Run Code Online (Sandbox Code Playgroud)
列出声卡
aplay -l
# aplay: device_list:268: no soundcards found...
Run Code Online (Sandbox Code Playgroud)
播放此声音将失败,因为此图像没有任何声卡
sudo aplay /usr/share/sounds/alsa/Front_Center.wav
Run Code Online (Sandbox Code Playgroud) 这是完整的错误.
RangeError: Maximum call stack size exceeded
at Injector._instantiate (http://localhost:8000/build.js:36366:63)
at Injector._instantiateProvider (http://localhost:8000/build.js:36244:23)
at Injector._new (http://localhost:8000/build.js:36234:21)
at InjectorInlineStrategy.instantiateProvider (http://localhost:8000/build.js:35998:30)
at ElementDirectiveInlineStrategy.init (http://localhost:8000/build.js:35106:20)
at new AppElement (http://localhost:8000/build.js:34800:24)
at viewFactory_constructor0 (viewFactory_constructor:74:26)
at viewFactory_constructor0 (viewFactory_constructor:76:1)
at viewFactory_constructor0 (viewFactory_constructor:76:1)
at viewFactory_constructor0 (viewFactory_constructor:76:1) <app id="NG2_UPGRADE_0_app_c0">
Run Code Online (Sandbox Code Playgroud)
这是我的源文件.
import 'reflect-metadata'
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser'
console.log('Files have started being compiled and infinite loop has begun');
var TodoCmpTest =
Component({
selector: 'todo-cmp'
})
.View({
template: `<h1>TodoCmpTest</h1>`
})
.Class({
constructor: function(){
console.log('hello');
}
});
var AppComponent …Run Code Online (Sandbox Code Playgroud) 我希望录制一些音频,然后才能播放它.能够自定义记录界面对我来说很重要.
在录制后的下面示例中,我得到-1的持续时间并且没有播放音频.
步骤1. 添加媒体插件
cordova plugin add org.apache.cordova.media
Run Code Online (Sandbox Code Playgroud)
第2步.我的代码
注意src是文档中请求的"amr".
Android设备以自适应多速率格式录制音频.指定的文件应以.amr扩展名结尾.
但是,我的文件结构中不存在"myrecording.amr",因为我希望它会被创建.
使用Javascript
var data = {
rec: ""
};
$scope.record = function(){
console.log('record');
var src = "myrecording.amr";
data.rec = new Media(src,
function() {
console.log("recordAudio():Audio Success");
},
function(err) {
console.log("recordAudio():Audio Error: "+ err.code);
});
data.rec.startRecord();
}
$scope.stopRecording = function(){
console.log('stop');
data.rec.stopRecord();
}
$scope.playRecording = function(){
console.log('play');
data.rec.play();
}
$scope.logDuration = function(){
console.log(data.rec.getDuration());
}
Run Code Online (Sandbox Code Playgroud)
HTML
<button ng-click="record()">Record</button>
<button ng-click="stopRecording()">Stop Record</button>
<button ng-click="playRecording()">Play Record</button>
<button ng-click="logDuration()">Log Duration</button>
Run Code Online (Sandbox Code Playgroud)
从上面输出 …
我有一个类将变量数据绑定到它的实例上.
class RouteData{
constructor(data: Object) {
// binding object attributes to instance
Object.keys(data).forEach((key) => { this[key] = data[key];})
}
}
let route: RouteData = new RouteData({hello: "test"})
console.log(route.hello);
Run Code Online (Sandbox Code Playgroud)
以上的结果是test.
但是,我在编译时遇到错误.
example.ts(9,19): error TS2339: Property 'hello' does not exist on type 'RouteData'.
如何声明此类的类型以允许绑定其类上的任何属性.
我希望能够防止删除云 SQL 实例。这似乎是避免愤怒员工或遗憾点击采取行动的好步骤。
我有我的域,abc.com并且我的页面中有一个iframe 123.com。我拥有每个域的代码。
通过服务人员,我可以abc.com在离线时123.com加载,但是即使我将其iframe 添加到cache.addAll呼叫中,我的iframe 也无法加载。
如何离线显示iframe?实例欢迎。
<!DOCTYPE html>
<html>
<head></head>
<body>
will render offline
<!-- will not render offline -->
<iframe src="123.com"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我想在Dockerfile中设置一个多行环境变量.
如果我通过docker run一切工作传入环境变量.
CONFIG="port: 4466
databases:
prod:
connector: mysql
active: true
host: 33.333.333.333
port: 3306
user: root
password: pass"
docker run --env CONFIG="$CONFIG" ubuntu:latest env | grep 'CONFIG'
Run Code Online (Sandbox Code Playgroud)
输出(它只有一行,因为它被解释为多行变量)
CONFIG=port: 4466
Run Code Online (Sandbox Code Playgroud)
Dockerfile
FROM ubuntu:latest
ENV CONFIG 'port: 4466\ndatabases:\n prod:\n connector: mysql\n active: true\n host: host\n port: 3306\n user: root\n password: pass'
Run Code Online (Sandbox Code Playgroud)
构建并运行docker镜像
docker build -t multilinetest .
docker run multilinetest env | grep 'CONFIG'
Run Code Online (Sandbox Code Playgroud)
产量
CONFIG=port: 4466\ndatabases:\n prod:\n connector: mysql\n active: true\n host: host\n port: 3306\n …Run Code Online (Sandbox Code Playgroud) 我试图在Javascript中通过id找到我的列表项的索引.例如,我有5个项目的列表,并给出一个元素,我想弄清楚它在列表中的位置.下面是我希望构建的代码.
它使用onclick处理程序来查找正在工作的元素,然后我只需要以某种方式计算元素在列表'squareList'中的位置.
window.onload=function(){
function getEventTarget(e){
var e=e || window.event;
return e.target || e.srcElement;
}
function selectFunction(e){
var target=getEventTarget(e);
alert(target.id);
}
var squareList=document.getElementById('squareList');
squareList.onclick=function(e){
selectFunction(e);
}
}
Run Code Online (Sandbox Code Playgroud)