자바스크립트에서 배열에 추가하는 건 push로 한다고


[링크 : https://www.w3schools.com/js/js_arrays.asp]

'Programming > javascript & HTML' 카테고리의 다른 글

select - option 투명 배경  (0) 2018.09.17
jquery 테이블 행 추가 / 삭제  (0) 2018.09.17
rest api ajax / jquery with HTTP header  (0) 2018.09.12
자바 스크립트 변수  (0) 2018.09.12
JSMpeg timestamp  (0) 2018.09.11
Posted by 구차니
Programming/node.js2018. 9. 14. 15:33


const readline = require('readline');


const rl = readline.createInterface({

  input: process.stdin,

  output: process.stdout,

  completer : completer

});


function completer(line) {

  const completions = '.help .error .exit .quit .q'.split(' ');

  const hits = completions.filter((c) => c.startsWith(line));

  // show all completions if none found

  return [hits.length ? hits : completions, line];

[링크 : https://nodejs.org/api/readline.html]

[링크 : https://gist.github.com/DTrejo/901104]


근데.. 해보는데 nodemon에서는 tab을 못 넘겨주도록 막는 듯?

'Programming > node.js' 카테고리의 다른 글

promise-mysql  (0) 2018.09.18
node.js 동기와 비동기 그리고 promise  (0) 2018.09.18
node.js mysql 모듈  (0) 2018.09.13
node.js 콘솔 입력 받기  (0) 2018.09.12
node.js JSON.parse()  (0) 2018.09.12
Posted by 구차니
Programming/node.js2018. 9. 13. 17:01

귀찮으면, results 필드만 쓰면 될 듯?

connection.query('SELECT * FROM `books` WHERE `author` = "David"', function (error, results, fields) {
  // error will be an Error if one occurred during the query
  // results will contain the results of the query
  // fields will contain information about the returned results fields (if any)

}); 

[링크 : https://www.npmjs.com/package/mysql]

[링크 : https://poiemaweb.com/nodejs-mysql]

[링크 : https://www.w3schools.com/nodejs/nodejs_mysql.asp]


[링크 : http://bcho.tistory.com/892]

'Programming > node.js' 카테고리의 다른 글

node.js 동기와 비동기 그리고 promise  (0) 2018.09.18
node.js readline 자동완성(autocompletion)  (0) 2018.09.14
node.js 콘솔 입력 받기  (0) 2018.09.12
node.js JSON.parse()  (0) 2018.09.12
node-rtsp-stream 사용  (2) 2018.09.12
Posted by 구차니
Programming/node.js2018. 9. 12. 18:53

node.js는 대개 서버용으로 쓰다 보니 콘솔 입력을 받을일이 없어야 하겠지만

그럼에도 불구하고 테스트 툴로 쓰려면 scanf()를 대체할 무언가가 필요하니 검색


require('readline');


[링크 : http://jam-ws.tistory.com/9]

'Programming > node.js' 카테고리의 다른 글

node.js readline 자동완성(autocompletion)  (0) 2018.09.14
node.js mysql 모듈  (0) 2018.09.13
node.js JSON.parse()  (0) 2018.09.12
node-rtsp-stream 사용  (2) 2018.09.12
node.js 글로벌 모듈 목록보기  (0) 2018.09.11
Posted by 구차니

node.js에서 작성하는거 처럼 인자랑 넣어주면 되는거 였군...


[링크 : https://stackoverflow.com/questions/25085012/how-to-call-rest-api-with-jquery-with-additional-headers]

[링크 : https://spring.io/guides/gs/consuming-rest-jquery/]

'Programming > javascript & HTML' 카테고리의 다른 글

jquery 테이블 행 추가 / 삭제  (0) 2018.09.17
자바스크립트 배열 관련  (0) 2018.09.14
자바 스크립트 변수  (0) 2018.09.12
JSMpeg timestamp  (0) 2018.09.11
html5 video timestamp  (0) 2018.09.11
Posted by 구차니

[] 배열

{} 객체


[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/Values,_variables,_and_literals]

[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/Working_with_Objects]

'Programming > javascript & HTML' 카테고리의 다른 글

자바스크립트 배열 관련  (0) 2018.09.14
rest api ajax / jquery with HTTP header  (0) 2018.09.12
JSMpeg timestamp  (0) 2018.09.11
html5 video timestamp  (0) 2018.09.11
html내 <script>의 올바른 위치(?)  (0) 2018.09.04
Posted by 구차니
Programming/node.js2018. 9. 12. 16:56

rest-client를 이용해서 프로그램을 짜보는데

[링크 : https://www.npmjs.com/package/node-rest-client]


헐.. 이미 json 객체인걸 또다시 파싱하려고 하면 에러나는거였구나..

undefined:1

[object Object]

 ^


SyntaxError: Unexpected token o in JSON at position 1 


Your data is already an object. No need to parse it. The javascript interpreter has already parsed it for you.

[링크 : https://stackoverflow.com/questions/15617164/parsing-json-giving-unexpected-token-o-error]





'Programming > node.js' 카테고리의 다른 글

node.js mysql 모듈  (0) 2018.09.13
node.js 콘솔 입력 받기  (0) 2018.09.12
node-rtsp-stream 사용  (2) 2018.09.12
node.js 글로벌 모듈 목록보기  (0) 2018.09.11
node-rtsp-stream 윈도우에서 설치하기는 실패?  (0) 2018.09.11
Posted by 구차니
Programming/node.js2018. 9. 12. 10:29

흐음..

일단은 되는데 안된다(응?)


app.js

Stream = require('node-rtsp-stream');

stream = new Stream({

    name: 'name',

    streamUrl: 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov',

    wsPort: 9999

}); 


view/index.pug

  script(src="javascripts/jsmpeg.min.js")

  div(class="jsmpeg" data-url="video.ts" disableGl="true")

  div(class="jsmpeg" data-url="ws://10.0.100.100:9999" disableGl="true") 


node_modules/node-rtsp-stream/lib/mpeg1muxer.js

//    this.stream = child_process.spawn("ffmpeg", ["-rtsp_transport", "tcp", "-i", this.url, '-f', 'mpeg1video', '-b:v', '800k', '-r', '30', '-'], {

    this.stream = child_process.spawn("ffmpeg", ["-rtsp_transport", "tcp", "-i", this.url, '-f', 'mpegts', '-codec:v', 'mpeg1video', '-b:v', '800k', '-r', '30', '-'], {


public

wget https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.avi

ffmpeg -i big_buck_bunny_480p_stereo.avi  -f mpegts -codec:v mpeg1video video.ts



disableGl은 적용이 안되는 것으로 보이고

변환한 ts와 외부 스트리밍은 문제없이 재생된다.




+

일단은 제어를 위해서 javascript 버전으로 구현

<script src="javascripts/jsmpeg.min.js"></script>

<canvas id="video-canvas"></canvas>

<script type="text/javascript">

var canvas = document.getElementById('video-canvas');

var url = 'video.ts';

var player = new JSMpeg.Player(url, {canvas: canvas});

player.play();


setInterval(function() {console.log(player.currentTime);}, 1000);

</script><button onclick="player.pause()"></button><button onclick="player.play()"></button>


[링크 : https://github.com/phoboslab/jsmpeg/blob/master/view-stream.html]


---

영상이 블럭이 생기며 신명나게 깨진다 -_ㅠ




fork된 node-rtsp-stream-es6 참조

[링크 : https://github.com/Wifsimster/node-rtsp-stream-es6/commit/1a52492fc9bf216e8fe646e4f13148694263a282]


ffmpeg -i rtsp://192.168.168.22 -f mpegts -codec:v mpeg1video -bf 0 -codec:a mp2 -r 30 http:// localhost:8081/1234/640/480 / ” 


[링크 : https://github.com/phoboslab/jsmpeg/issues/149]



'Programming > node.js' 카테고리의 다른 글

node.js 콘솔 입력 받기  (0) 2018.09.12
node.js JSON.parse()  (0) 2018.09.12
node.js 글로벌 모듈 목록보기  (0) 2018.09.11
node-rtsp-stream 윈도우에서 설치하기는 실패?  (0) 2018.09.11
node.js HTTP 요청하기  (0) 2018.09.10
Posted by 구차니

되긴 하지만 처음 시점이 0초로 잡힌다고..

html5 video 처럼 얘도 1초 단위다 -_ㅠ


[링크 : https://github.com/phoboslab/jsmpeg/issues/108]


JSMpeg.Player API

A JSMpeg.Player instance supports the following methods and properties:


.play() – start playback

.pause() – pause playback

.stop() – stop playback and seek to the beginning

.destroy() – stops playback, disconnects the source and cleans up WebGL and WebAudio state. The player can not be used afterwards.

.volume – get or set the audio volume (0-1)

.currentTime – get or set the current playback position in seconds 

[링크 : https://github.com/phoboslab/jsmpeg]

'Programming > javascript & HTML' 카테고리의 다른 글

rest api ajax / jquery with HTTP header  (0) 2018.09.12
자바 스크립트 변수  (0) 2018.09.12
html5 video timestamp  (0) 2018.09.11
html내 <script>의 올바른 위치(?)  (0) 2018.09.04
jquey ajax 테스트  (4) 2018.09.03
Posted by 구차니

초 단위로 설정이나 읽는게 가능

(프레임 단위나 msec 단위는 안되는 듯)


[링크 : https://stackoverflow.com/questions/6380956/current-duration-time-of-html5-video]

[링크 : https://www.w3schools.com/tags/av_prop_currenttime.asp]

'Programming > javascript & HTML' 카테고리의 다른 글

자바 스크립트 변수  (0) 2018.09.12
JSMpeg timestamp  (0) 2018.09.11
html내 <script>의 올바른 위치(?)  (0) 2018.09.04
jquey ajax 테스트  (4) 2018.09.03
jquery 복수 속성 선택하기  (0) 2018.08.30
Posted by 구차니