Closed punkwang closed 7 years ago
Yeah, webtorrent_cli.js
is a bit of a hack. LiquidServer is not mature enough yet to deal with really complex JavaScript.
To make the file, do the following:
% mkidr temp
% cd temp
% npm install webtorrent-cli
% cp $NODE_MODULES/webtorrent-cli/bin/cmd.js .
Then, edit cmd.js
and add the two LiquidCore lines:
...
LiquidCore.emit('torrent_done', { files: torrent.files });
torrentDone() // <-- Add the above line before this one
and
...
LiquidCore.emit('draw', { progress: torrent.progress });
peerslisted += 1 // <-- Add the above line before this
return linesRemaining > 4
And finally, comment out the ascii-logo.txt
chunk:
function runHelp () {
/* <-- add this
fs.readFileSync(path.join(__dirname, 'ascii-logo.txt'), 'utf8')
.split('\n')
.forEach(function (line) {
clivas.line('{bold:' + line.substring(0, 20) + '}{red:' + line.substring(20) + '}')
})
*/ // <-- and this
Then,
% browserify -o webtorrent_cli.js --node --im --noparse=process --noparse=assert --noparse=buffer --noparse=child_process --noparse=constants --noparse=crypto --noparse=events --noparse=fs --noparse=os --noparse=path --noparse=process --noparse=readline --noparse=stream --noparse=url --noparse=util --noparse=vm cmd.js
It should work. You might have an issue with an exception looking for package.json
. If that's the case, after the file is generated, comment out the line where it is requesting it.
i try to use "peerflix" but can not to work
04-06 14:19:37.125 6930-6970/com.liquidtest E/libGameXtend: LUCID_1 (1491459577125) PowerXtend identified application start. Package name: com.liquidtest. Application is handled by GameXtend 04-06 14:19:38.423 6930-7028/com.liquidtest W/System.err: java.lang.reflect.InvocationTargetException 04-06 14:19:38.424 6930-7028/com.liquidtest W/System.err: at java.lang.reflect.Method.invoke(Native Method) 04-06 14:19:38.424 6930-7028/com.liquidtest W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) 04-06 14:19:38.424 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:541) 04-06 14:19:38.424 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:511) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: Caused by: Error: access denied (EACCES) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.javascript.JSContext.evaluateScript(JSContext.java:264) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.javascript.JSContext.evaluateScript(JSContext.java:277) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.service.MicroService.onProcessStart(MicroService.java:517) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.node.Process.eventOnStart(Process.java:244) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.node.Process.access$800(Process.java:47) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.node.Process$3.__nodedroid_onLoad(Process.java:342) 04-06 14:19:38.425 6930-7028/com.liquidtest W/System.err: ... 4 more 04-06 14:19:38.426 6930-7028/com.liquidtest W/System.err: Error: java.lang.reflect.InvocationTargetException 04-06 14:19:38.427 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:551) 04-06 14:19:38.427 6930-7028/com.liquidtest W/System.err: at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:511)
can you try to make "peerflix"
thanks
"webtorrent_cli" can not work !!!!
Why don't you just use the webtorrent_cli.js
that is included in the example project? It works.
the "webtorrent_cli.js" demo can not work in my android real device
Can you try this one? I tested this just yesterday and it worked for me. If it fails, please send me the dalvik log.
Closing. Please reopen if this doesn't work.
how to make "webtorrent_cli.js"