我正在尝试运行PNaCl ffmpeg端口并运行一些基本命令。很遗憾,我只是设法在 index.html :
中打印此错误> NaCl模块加载失败:Nexe在启动期间崩溃
我从here获得了预建端口,我的Chrome版本为43.0.2357.132
。
ffmpeg.nmf
{
"program": {
"portable": {
"pnacl-translate": {
"url": "ffmpeg"
}
}
}
}
在下载的端口包的ffmpeg
路径中找到的 payload\bin
文件没有.pexe
扩展名。我认为只要nacl manifest没有指定它就不会有问题。正确?
的index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<h2>Status: <code id="statusField">LOADING</code></h2>
<div id="listener">
<script type="text/javascript">
var listener = document.getElementById('listener');
listener.addEventListener('load', moduleLoadEventHandler, true);
listener.addEventListener('message', messageEventHandler, true);
listener.addEventListener('error', errorEventHandler, true);
listener.addEventListener('crash', crashEventHandler, true);
</script>
<embed id="ffmpeg"
width=0 height=0
src="ffmpeg.nmf"
type="application/x-pnacl"/>
</div>
<div id="logs"></div>
</body>
</html>
main.js
var ffmpegModule = null;
var logMessageArray = [];
var kMaxLogMessageLength = 20;
function domContentLoadEventHandler() {
ffmpegModule = document.getElementById('ffmpeg');
}
function moduleLoadEventHandler() {
ffmpegModule = document.getElementById('ffmpeg');
setStatus('SUCCESS');
}
function messageEventHandler(eventArgs) {
logMessage('Message received: ' + eventArgs.data);
}
function errorEventHandler(eventArgs) { //Function that prints the error
setStatus('ERROR [' + ffmpegModule.lastError + ']');
}
function crashEventHandler() {
if (ffmpegModule.exitStatus == -1) {
setStatus('CRASHED');
}
else {
setStatus('EXITED [' + ffmpegModule.exitStatus + ']');
}
if (typeof window.handleCrash !== 'undefined') {
window.handleCrash(ffmpegModule.lastError);
}
}
function setStatus(statusText) {
var statusField = document.getElementById('statusField');
statusField.innerHTML = statusText;
}
function logMessage(message) {
logMessageArray.push(message);
if (logMessageArray.length > kMaxLogMessageLength) {
logMessageArray.shift();
}
document.getElementById('logs').textContent = logMessageArray.join('\n');
}
document.addEventListener("DOMContentLoaded", domContentLoadEventHandler);
生成文件
我也从nacl_sdk教程中将这个小makefile“偷走”。
HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py
all: serve
.PHONY: serve
serve:
$(HTTPD_PY) -C $(CURDIR) --no-dir-check