Androidã¬ãžã§ããããPCã®ãªã¢ãŒãã³ã³ãããŒã«ã¢ããªã±ãŒã·ã§ã³ã«ãããªããã³ãªãŒãã£ãªã¹ããªãŒã ã転éããããã®æ¯èŒçç°¡åã§å®çšçãªæ¹æ³ãèŠã€ããããšã¯å°é£ã§ããããšãå€æããŸããã ãã®ã¹ãããããªããã°ãç§ã¯æåºãšããŠå ã«é²ãããšãæãŸãªãã£ãã®ã§ãé·ãéé åºãã«ç«ã¡åŸçããŸããã
ç§ãå©ããŠããããã¹ãŠã®äººã«æè¬ããŸããå©ãããªããã°ãç§ã¯ãã®ã¿ã¹ã¯ããã¹ã¿ãŒã§ããªãã£ãã§ãããã å¿ãåãããã人ã ãšã®éä¿¡ã¯ãç§ãéåžžã«æ¥œãããŠé¢çœã人ã ãšäžç·ã«é£ããŠæ¥ãŸããã ããããMityaã¯ãç§ã粟ç¥çã«è¿ã人ãèŠã€ããã®ãå©ããŠãããããšãããããŸããã ãããŠãããã¯ç§ã«ãšã£ãŠå šãäºæ³å€ã®ããŒãã¹ã§ããã ããããããã趣å³ã®äž»ãªãå©çãã§ããããïŒ ãã£ãä»ãç§ã¯ã³ãã¥ãã±ãŒã·ã§ã³ãåãªããéä»äºããããéèŠã§ããããšã«æ°ä»ããŸããã å ±æãã人ãçžè«ãã人ãèªæ ¢ãã人ãããªãã®ã«ããªãããããã¹ãŠå¿ èŠãªã®ã§ããããïŒ
ææã®åæ è©©çãªèŠçŽ ã§ç· ãããããŸãã ãã®èšäºã¯ãMityaããããã«é¢ããç©èªã®ç¶ãã§ãã æåã®éšåã§ã¯ããããããã©ã®ããã«æ§ç¯ãããã説æãã 2çªç®ã® éšåã§ã¯ãããã°ã©ãã³ã°ã«å¿ èŠãªãã®ã説æããŸããã ãã®èšäºã§ã¯ããããããããªãã¬ãŒã¿ãŒã«ãããªãšé³å£°ãéä¿¡ããåé¡ã«éäžããŸãã ããã§ã¯ãç¹ã«ãããžã§ã¯ãå šäœãšãã®ãœãããŠã§ã¢ã¢ãŒããã¯ãã£ã«ã€ããŠã¯ç¹°ãè¿ããŸããããããã®åé¡ã«ã€ããŠã¯ãæåã®éšåã§è©³ãã説æããŸãã
æããšããµã€ãã£ã³ã°ãªè³ªåïŒçµæã¯äœã§ãããç»åãšé³ã¯ã©ããããé ããªããŸããïŒ ãããç§ã®ãããªã¬ã¹ãã³ã¹ã§ãã
å¹²æžããaã³ããŸãããç§ã¯ééããªããªãªãžãã«ã®ãµãŠã³ããšPCã§åçããããµãŠã³ãã®äž¡æ¹ãå®èšŒããªããã°ãªããŸããã§ããã ãã¡ãããé ãããããŸãã ããã«ãåçäžãé³ã¯åçãããããã«é ããŸãã ãããªã¯çŸå®ã«ã»ãã®å°ãé ããŠããŸãïŒçµå±ãããã¯ã¢ããã°ã·ã¹ãã ã§ã¯ãªãããšãèæ ®ãããã¹ãŠã匷åãªé»è©±ã§å®è¡ã§ããããã«ããå¿ èŠããããŸãïŒã ç§ã¯ãããããå¶åŸ¡ããããšããŸãããããããªã¯ãã®ãããªé 延ã§äžå¿«æãçµéšããŸããã§ããã ã ããç§ã¯çµæã«éåžžã«æºè¶³ããŠããŸãã-é³ã«ããããªé ããããã®ã§ãç§ã¯ãããææ ¢ããæºåãã§ããŠããŸãã
ãªãã¬ãŒã¿ãŒã«è¡šç€ºãããç»åã®å質ã¯ãHTC Sensationã®ããã³ãã«ã¡ã©ã察å¿ã§ãããã®ã«å¯Ÿå¿ããŠããŸãã ã¡ã€ã³ã«ã¡ã©ã䜿çšããããšãã§ããŸããããã®åŸã¯ããã£ã¢ã®è¡šæ ãæŸæ£ããªããã°ãªãããããã¯ã§ããŸããã
ããã²ãŒã·ã§ã³ãç°¡åã«ããããã«ãèšäºã®ãããªãã³ã³ãã³ãã®èšç»ãæäŸããŸãã
1. ãœãªã¥ãŒã·ã§ã³ã®é²åïŒå¥œå¥å¿uriousçãªäººã®ã¿ïŒ
2. IPãŠã§ãã«ã¡ã©
3. Windowsã¢ããªã±ãŒã·ã§ã³ã§ãããªãåçãã
4. Windowsã¢ããªã±ãŒã·ã§ã³ã§ãµãŠã³ããåçãã
5. ãŸãšã
ãœãªã¥ãŒã·ã§ã³ã®é²åïŒå¥œå¥å¿ã®ããã ãïŒ
ãè€æ°æåãã§ç§ã責ããªãããã«ã劥åæ¡ãæ瀺ããŸãïŒå¥œå¥å¿ã匷ãããŸãã¯ãããžã§ã¯ãã«åæ ããããŸãã¯åã«æãããã®ãã人ïŒç§ãããããã¹ãŠæžããããã§ã¯ãªãïŒã¯ãç§ãã©ã®ããã«åºãŠãç§ãèŠã€ããŠæåŠãã解決çãèªãããšãã§ããŸãã
çå£ã«ãç§ã¯åŸããããã¹ãŠã®çµéšãå¯èœãªéãå ±æããããšæããŸãããªããªãã䟡å€ã¯ããžãã£ããªçµéšã§ããã ãã§ãªãããã¬ãã£ããªçµéšã§ããããšç¢ºä¿¡ããŠããããã§ãã ä»äººã®éã¡ããåŠã¶ããšãã§ãã人ããããã©ããªãã§ããããïŒ ããã«ã誰ããåºäŒã£ãè¡ãæ¢ãŸãããæãåºãæ¹æ³ãèŠã€ãããèŠãããããŠããããããšãŠããããããã§ãã ãããŠãããã¯çµéšã®äº€æã«ãªãã§ãããã
ãã®ã»ã¯ã·ã§ã³ã§ã¯ãè¡ãæ¢ãŸãã«ã€ããŠæžããŠããŸãã ãããªãšãµãŠã³ããããããããPCã«è»¢éããããã®ã¬ã·ããæ¢ããŠããã ããªãã次ã®ã»ã¯ã·ã§ã³ã«é²ãããšãã§ããŸãã
ã¢ã€ãã¢ã¯ã·ã³ãã«ã§ãããAndroidã¢ããªã±ãŒã·ã§ã³ã®ã¬ãã«ã§ãããªããã³ãªãŒãã£ãªã¹ããªãŒã ã®ç¿»èš³ãå®è£ ããã³ãŒããåã蟌ã¿ãWindowsã³ã³ãããŒã«ã¢ããªã±ãŒã·ã§ã³ã®ã¬ãã«ã§ãããã®ã¹ããªãŒã ãåä¿¡ããã³åçããã³ãŒããåã蟌ã¿ãŸãã
ç§ã®ã³ãŒãã«çµ±åãããŠããªãæ¢è£œã®è£œåã䜿çšããããããçš®é¡ã®ãããŒãã€ããœãªã¥ãŒã·ã§ã³ã¯ãããã«åŽäžãããŸããã
ç§ã¯ãããªããå§ããŸããã ãããŠãäœããã®çç±ã§ããããªã¹ããªãŒã ã®åœ¢æãšå€æã«åé¡ã¯ãªããšç¢ºä¿¡ããŸããã XXIäžçŽãçµå±ã®ãšããã誰ãã®ã¹ããŒããã©ã³ã¯ãã§ã«ã¯ã¢ããã³ã¢ã§ã... åæºåž¯é»è©±ã«ã¯2å°ã®ã«ã¡ã©ãæèŒãããŠãããšããäºå®ã«ãããããããæºåž¯é»è©±ããWebã«ã¡ã©ãäœæããã®ã¯ããã»ã©ç°¡åã§ã¯ãããŸããã é©ãã¹ãããšã«ããã®åé¡ã解決ããããã®æ¢è£œã®ãœãããŠã§ã¢ããŒã«ãAndroidã«çµã¿èŸŒãŸããŠããŸããã ãã®åé¡ã¯æºåž¯é»è©±ã¡ãŒã«ãŒã«ãšã£ãŠæè¡çãªåé¡ã§ã¯ãªããããçç±ã¯ããããŸããããäžéšã®åœã§ã¯ãã®ãããªãœãããŠã§ã¢ãæèŒããããã€ã¹ã®èªèšŒã®è€éããåå ã§ãããšèããããŸãã çªç¶ãããã¯ãã§ã«ã¹ãã€æ©åšã§ããïŒ ãããç§ãæãã€ãå¯äžã®èª¬æã§ãã ããããããã£ã¢ã¯ã¢ãŒã¿ãŒã§é³Žãé¿ãã®ã§ã圌ããã®åµå¯ã¯ã«ãããã®é¢šè¹ã®ããã§ãã ãããã£ãŠãäžç çã®è¯å¿ã¯ç§ãèŠãããŸããã
googleãcode.googleãstackoverflowãandroid developersãall-all-allãæãäžããŠã¿ããšãéåžžã«èå³æ·±ãããã©ãã«ãæ¥ãªããœãªã¥ãŒã·ã§ã³ãèŠã€ãããŸããã ãããŠãç§ã¯ãããã«å€ãã®æéãè²»ãããŸããã 念ã®ãããããããšããããããããæåŠããçç±ã説æããŸãã çµéšã圹ç«ã€å ŽåããããŸãã äžéšã®ã¿ã¹ã¯ã§ã¯ããããã®ãœãªã¥ãŒã·ã§ã³ã¯éåžžã«é©ããŠããŸãããç§ã¯ããããšåéã«ãªããŸããã§ããã å®å šã«ãããããã¯ãªãã·ã§ã³ãçç¥ããŸãã ãã£ã³ã¹ããã人ã ããæ®ããŸãã
ãªãã·ã§ã³1ïŒAndroidã®äžéšã§ããMediaRecorderã¯ã©ã¹ã䜿çšããŸãã ç§ã¯ããã«ããã¹ãŠã®åé¡ã®è§£æ±ºçã ãšæã£ãŠããŸãã-ããã«ãããªãšãªãŒãã£ãªã®äž¡æ¹ããããŸãã åºåã§3gpã¹ããªãŒã ãåä¿¡ããUDPçµç±ã§PCã«éä¿¡ããŸãã ããããæ²ããããªã MediaRecorderã¯ã¹ããªãŒã ã§åäœããªãããããã¡ã€ã«ã®åŠçæ¹æ³ã®ã¿ãç¥ã£ãŠããŸãã ã°ãŒã°ã«ã groups.google.comãã©ãŒã©ã ã§éåžžã«èå³æ·±ãè°è«ãèŠã€ããŸããã åæ§ã®ã¿ã¹ã¯ãããã§è°è«ããããã®è°è«ã®äžã§ãå¥ã®èå³æ·±ãæçš¿ãžã®ãªã³ã¯ãæµ®äžããŸããã MediaRecorderã«ãã¡ã€ã«ãæäœããŠãããšæãããåºåã¹ããªãŒã ãå®éã«ãœã±ããã«æ¿å ¥ããŠèšé²ããæ¹æ³ãããããã³ã°ãããæ¹æ³ã«ã€ããŠèª¬æããŸãã å®è£ ã®èª¬æã¯ç¹°ãè¿ããããã¹ãŠãããã«æžãããŠããŸãã ãã®ãªãã·ã§ã³ã¯ããã£ã¹ã«ãã·ã§ã³ã®åå è ã«éåžžã«é©ããŠããŸããã ã¿ã¹ã¯ã¯ãé»è©±ã®ã¡ã¢ãªã«ãŒãããã€ãã¹ããŠãé»è©±ãããªã¢ãŒãã³ã³ãã¥ãŒã¿ãŒäžã®ãã¡ã€ã«ã«ãããªãèšé²ããããšã§ããã ããã¯ãã¡ã€ã«ã®äžã«ãããŸãã-ãã®ãªãã·ã§ã³ãããæ·±ãç 究ããŠãç§ã¯ããããŠã§ããã£ã¹ãã«é©ããŠããªããšç¢ºä¿¡ããŸããã å®éãç§ã®ããã€ã¹ã®MediaRecorderã¯æ¬¡ã®ããã«æ©èœããŸãããããªãéå§ããããšããã¡ã€ã«ãäœæããããã®å é éšåã«ã¹ããªãŒã ãµã€ãºãèšé²ããããã®å ŽæãäºçŽãããŸãã ãã®ãã£ãŒã«ãã¯ããããªãå®äºãããšãã«ã®ã¿å ¥åãããŸãã ãã®ãããMediaPlayeråºåã¹ããªãŒã ã¯ããžã·ã§ãã³ã°ïŒã·ãŒã¯æäœïŒããµããŒãããå¿ èŠããããŸãã ããšãã°ããã¡ã€ã«ã¹ããªãŒã ã¯ããã«å¯Ÿå¿ããŠããããããã¯ãŒã¯çµç±ã§ãããŒããã£ã¹ãããå Žåãã¹ããªãŒã ã¯ãã¡ããå³å¯ã«ã·ãŒã±ã³ã·ã£ã«ã§ãããæåã«ãžã£ã³ãããŠãã£ãŒã«ããæçµãµã€ãºã§åããããšã¯ã§ããŸããã ãããã圌ãã«ã¯ãªã¢ãŒãã³ã³ãã¥ãŒã¿ãŒäžã®ãã¡ã€ã«ã«æžã蟌ãã¿ã¹ã¯ããããŸããã ãããã£ãŠã圌ãã¯æåã«ã¹ããªãŒã ããã¡ã€ã«ã«ã泚ããã次ã«ãã®ãã¡ã€ã«ãèšé²ã®ããã«éããé©åãªå Žæã«ãã®ãµã€ãºãå ¥åããŸããã ãã®åŸããã®ãããªãã¡ã€ã«ã¯ãã§ã«äœã§ãåçã§ããŸãã
ç§ã®ãããžã§ã¯ãã®ã¿ã¹ã¯ã¯ç°ãªããŸããé²é³ãå®äºããæéããããŸããã ãããŠãç§ã¯ãããªã¹ããªãŒã ã®ãµã€ãºã決å®ããããšã¯ã§ããŸããã ã€ãŸã MediaPlayerã®åºåã¹ããªãŒã ã¯ããŠã§ããã£ã¹ãçšã§ã¯ãããŸããã å°ãªããšãç§ã®ããã€ã¹ã§ã¯ã ãã®ãªãã·ã§ã³ã¯æšãŠãªããã°ãªããŸããã§ããã
ããŠãç§ã¯èªåã§ãã¹ãŠãããããšããããšã«ããŸããã Androidã¯ãããã€ã¹ã®ã«ã¡ã©ããçã®ãã¬ãŒã ãååŸããæ©èœãæäŸããŸãã ãã®æ©èœã¯ã©ãã§ãé¡èã«èª¬æãããŠããŸããã€ã³ã¿ãŒãããã«ã¯ãããã€ã¹ã®ã«ã¡ã©ããã®ãã¬ãŒã ãå«ãåä¿¡ã¹ããªãŒã ãjpegãã¡ã€ã«ã«å€æãããã®ãã¡ã€ã«ãã¡ã¢ãªã«ãŒãã«ä¿åããäŸããããããããŸãã ç§ã®å Žåãjpegãã¬ãŒã ã®ã¹ããªãŒã ã¯ãPCã®UDPã§é§åã§ããŸãã ããããã¹ããªãŒã ãå£ããŠããå Žåã¯ã©ããªããŸããïŒçµå±ãUDPã§ãïŒïŒ ãã¬ãŒã ãã©ãã«ã§äœããã®åœ¢ã§åé¢ãããããã®ããã«jpegããããŒã䜿çšããå¿ èŠããããŸãã PCã§ã¯ãäœããã®æ¹æ³ã§ãã¬ãŒã ãã¹ããªãŒã ããåé¢ããå¿ èŠããããŸãã ããã¯ãªããšãªãäœã¬ãã«ã§ããããããã£ãŠãç§ã¯ããããŸã£ãã奜ãã§ã¯ãããŸããã§ããã ééããªãæ¢è£œã®ã³ãŒããã¯ã䜿çšããå¿ èŠããããŸãã äœããã®çš®é¡ã®æšæºã¡ãã£ã¢ãããã³ã«ã䜿çšããããšãçŽ æŽãããã§ãããã ãããŠãç§ã¯ãã®æ¹åã§æ å ±ãåéãå§ããŸããã ãã®ããã2çªç®ã®ãªãã·ã§ã³ã¯çãŸããã«èœã¡ã3çªç®ã®ãªãã·ã§ã³ã¯ffmpegã䜿çšããŸãã
ffmpegã¯åœç¶ãã®åéã§æã人æ°ããã人æ°ã®ãã補åã§ãã éçºãããã³ãã¥ããã£ã®ãããã§ã圌ã«é Œãããšã¯éåžžã«å¯èœã§ãããç§ã¯ä»åŸã®äœæ¥ã®æ¹åæ§ã決å®ããããšã«ããŸããã ãããŠãç§ã¯2ã¶æéæããŸããã ffmpeg for Androidèªäœãã³ã³ãã€ã«ããå¿ èŠãããããšãããããŸããã åæã«ãffmpegã¯Cã§èšè¿°ãããŠãããããAndroid NDKã«ç²Ÿéããå¿ èŠããããŸããAndroidåãã®ffmpegã®æ§ç¯ã¯ãWindowsã§ã¯éåžžã«å°é£ã§ãã ãé£ããããããã¯å®å šã«èª å®ã§ã¯ãããŸãããå®éãWindowsã§ã®ã³ã³ãã€ã«ã®æåã«ã€ããŠèšåããããšã¯äžåºŠããããŸããã ãã®ããŒãã«ã€ããŠã¯å€ãã®è³ªåããããŸããã圌ãã¯ãã¹ãŠã®ãã©ãŒã©ã ã«Linuxã1ã€ã®å£°ã§å±éããããšãæšå¥šããŠããŸãã ããŠãããããç¶æ³ã¯å€ãã£ãã§ããããããã«ç§ã®ããã°ã®èšäºã«å¯Ÿãã質åãšç§ã®çãããããŸãã Linuxã®äœ¿çšçµéšã¯ãããŸããã ãããããã®ãããªç£ãUbuntuãã€ã³ã¹ããŒã«ããªããã°ãªããªããšãã奜å¥å¿ã«æžæããŸããã ããã«ãã€ã³ã¿ãŒãããäžã®ffmpegã®ã³ã³ãã€ã«ã«é¢ããé¢é£æ å ±ã¯ãªãããšãå€æããŸããã ããªãèŠãã¿ãŸãããã圌ã¯ãŸã åæãããffmpegãéããããšãã§ããŸããã ã¢ã»ã³ããªããã»ã¹ã«ã€ããŠã¯ãããã°ã§è©³ãã説æããŸããã
ãã®ç¬éãŸã§ã«ãããã£ã¢ã¯é·ãéé ã«ã»ãããéããŠããŸããã ãããŠãAndroid NDKãšã®æ°ãããŠå®å šã«åã³ã®ãªãæŠããffmpeg APIã®ããã¥ã¡ã³ãã®å®å šãªæ¬ åŠãã³ãŒããã¯ã®è¬ãšffserverïŒããã¯ffmpegãããžã§ã¯ãã®äžéšã§ããã¹ããªãŒãã³ã°ãããªãµãŒããŒã§ãïŒã®æ²¡å ¥ã«ç§ã®ç®ã®åã«è¿«ããŸããã ffserverã䜿çšãããšããããããããããã¯ãŒã¯äžã®ä»»æã®PCãžã®ãããªãšãªãŒãã£ãªã®ãããŒããã£ã¹ããæŽçã§ããŸãã åéã¯ãã§ã«ããããå·¥åŠã§çãå°œãããšæã£ãŠãæ³£ããåºããŸããããè±åŽå²©ããããç¶ããŸããã ãã®æ¹æ³ã§æåŸãŸã§è¡ãããã©ããã¯ããããŸããã
ãããŠãå©ããæ¥ãŸããã èŠããŠãããŠãç§ã¯ç§ãå ±éã®è¶£å³ãå ±æããçŽ æŽãããå¿ãåãããã人ã ã«ã€ããŠè©±ããŠããã®ã§ããïŒ ããããããã£ã¢ã¯ãã®æç¹ã§äžäººã§ã¯ãªãã£ããšèšããªããã°ãªããŸããã å¥ã®éœåžã§ã¯ã圌ã¯ãã§ã«å€èŠã¯éåžžã«äŒŒãŠããããã«èŠããŸããããããã€ãã®å Žæã§ã¯å å¿ã§ç°ãªã£ãŠããŸããã ãã®ããããã®äœè ã§ããLuke_Skypewalkerã«å¯Ÿå¿ããŸãã 圌ããã®æ¬¡ã®æçŽã«ã¯ã IP WebcamãšåŒã°ããAndroidã¢ããªã±ãŒã·ã§ã³ãèŠãããã®ã¢ããã€ã¹ããããŸãã ãŸãããã®ã¢ããªã±ãŒã·ã§ã³ãAndroidããã€ã¹ããHTTPãããªãšãµãŠã³ãããããŒããã£ã¹ãããAPIãåããŠãããããã¯ã°ã©ãŠã³ãã§åäœããããšãããããŸãã
Mityaããããã«é¢ããèšäºã®æåã®éšåããããžã§ã¯ãã®Webãµã€ãã§å ¬éããåŸãIP WebcamãèŠãŠãŠãŒã¶ãŒkib.demonããã³ã¡ã³ããåãåã£ãããšãèªããªããã°ãªããŸããã ç§ã¯èŠãŸããããã²ã©ããäž»ãªãã®ãèŠãŸããã§ãã-ãã®ã¢ããªã±ãŒã·ã§ã³ã«ã¯ãœãããŠã§ã¢APIããããŸãã ãŠã§ãã«ã¡ã©ãããèªäœã«å®è£ ããã¢ããªã±ãŒã·ã§ã³ã¯å¿ èŠãªããšèããããã«ãã®ååšãå¿ããŸããã ãŸããèšäºèªäœãžã®ã³ã¡ã³ãããããŸããã APIã«ã€ããŠã¯èšãããŠããŸããããç§ãèŠéããŸããã ãã®ãã¹ã«ãããããã£ã¢ã¯ã³ãŒããŒã§3ãæããããŸããã
ffmpegã§ç¡é§ã«æã£ããšã¯æããªãã ç§ã®æçš¿ïŒãŸã è±èªçããããŸããïŒã®åŸã圌ãã¯ç§ã«å€ãã®è³ªåãéã£ãŠãããŸããã ç§ã¯æé«ã®ç¥èã«çããããšããŸãããã»ãšãã©ã®è³ªåã¯ç©ºäžã«æµ®ããã§ããŸãã ãããã¯ã¯ãŸã é¢é£ããŠããŸãã 誰ãããã®ä»äºãç¶ããŠèª¬æããŠãããããšãŠãããããã§ãã ããã§ããffmpegãšã®ãœãããŠã§ã¢ã®çžäºäœçšã«ã€ããŠã¯ãã€ã³ã¿ãŒãããäžã«ã¯ã»ãšãã©äœããããŸããã ãããŠãäœå¹Žãã¯æ代é ãã§ãã é©åãªã³ãŒããã¯ã䜿çšããããšã«ãããffmpegã䜿çšãããšãæå°ã®ãã©ãã£ãã¯ããæ倧ã®ãããªãçµãåºãããšãã§ããŸãã å€ãã®ãããžã§ã¯ãã§ã¯ãããã¯éåžžã«äŸ¿å©ã§ãã
IPãŠã§ãã«ã¡ã©
ããã§ãMitiããããã®Androidéšåã®ã¬ãã«ã決å®ããŸãããIPWebcamã¯ããããªãšãªãŒãã£ãªã®ãããŒããã£ã¹ãã«äœ¿çšãããŸãã
éçºè ã®ãµã€ãã«ã¯ãAPIã§äœ¿çšå¯èœãªæ©èœã説æããããŒãžããããŸãã ããã§ãããã°ã©ã ã§IP Webcamãšå¯Ÿè©±ããæ¹æ³ã瀺ãå°ããªAndroidãããžã§ã¯ãã®ãœãŒã¹ã³ãŒããããŠã³ããŒãã§ããŸãã
å®éããã®äŸã®éèŠãªéšåã¯æ¬¡ã®ãšããã§ãã
Intent launcher = new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME); Intent ipwebcam = new Intent() .setClassName("com.pas.webcam", "com.pas.webcam.Rolling") .putExtra("cheats", new String[] { "set(Photo,1024,768)", // set photo resolution to 1024x768 "set(DisableVideo,true)", // Disable video streaming (only photo and immediate photo) "reset(Port)", // Use default port 8080 "set(HtmlPath,/sdcard/html/)", // Override server pages with ones in this directory }) .putExtra("hidebtn1", true) // Hide help button .putExtra("caption2", "Run in background") // Change caption on "Actions..." .putExtra("intent2", launcher) // And give button another purpose .putExtra("returnto", new Intent().setClassName(ApiTest.this,ApiTest.class.getName())); // Set activity to return to startActivity(ipwebcam);
泚ç®ãã¹ãããšã¯ãæŸéãããªã®åãã解å床ãããã³ç»è³ªãå¶åŸ¡ã§ããããšã§ãã èé¢ã«ã¡ã©ãšåé¢ã«ã¡ã©ãåãæ¿ãããã©ãã·ã¥LEDããªã³ãŸãã¯ãªãã«ããããšãã§ããŸãã ããã¯ãã¹ãŠããããŒããã£ã¹ããéå§ããåã«èšå®ã§å¶åŸ¡ãããããããžã§ã¯ãã®äœæè ãæäŸããããŒãã³ãŒãã䜿çšããŠããã°ã©ã ã§å¶åŸ¡ã§ããŸãã
ããã¯äŸã«ç€ºãããŠããŸãã
å°ãæ°ãæ£ããïŒæ®å¿µãªãããã©ãã·ã¥ïŒãããã©ã€ãããã£ã¢ïŒã§ç§ã¯ãã³ã¯ããŠããŸãã ããã¯IP Webcamã«ã¯é©çšãããŸããã ç§ã¯ä»¥åã«èªåã®ã³ãŒãã§ãã§ã«ãã®åé¡ã«ééããŠããŸãã ç§ã®ããã€ã¹ã§ã¯ãããã³ãã«ã¡ã©ãã¢ã¯ãã£ãã«ãããšããã©ãã·ã¥ãå¶åŸ¡ã§ããªããªããŸãã ããã¯HTC Sensationã ãã§ã¯ãªãããã§ãã
IP Webcamã¢ããªã±ãŒã·ã§ã³ã§ã¯ããããŒããã£ã¹ããéå§ããåŸãã¢ã¯ãã£ããªã«ã¡ã©ããã®ãããªãç»é¢ã«è¡šç€ºããå§ããŸãã ãããªã®äžéšã«ã2ã€ã®ã«ã¹ã¿ã ãã¿ã³ã衚瀺ãããŸãã ããã©ã«ãã§ã¯ã1ã€ã¯ãã«ããã€ã¢ãã°ãéå§ãã2ã€ç®ã¯å©çšå¯èœãªã¢ã¯ã·ã§ã³ã®ã¡ãã¥ãŒãéããŸãã ãã®äŸã§ã¯ãäœæè ã¯æåã®ãã¿ã³ãé衚瀺ã«ãã2çªç®ã®ãã¿ã³ãèšå®ããŠãã¢ããªã±ãŒã·ã§ã³ãããã¯ã°ã©ãŠã³ãã§ç¿»èš³ããŸãã
ããšãã°ããã©ãŠã¶ãŸãã¯VLCã¡ãã£ã¢ãã¬ãŒã€ãŒã¢ããªã±ãŒã·ã§ã³ã§ããªãŒãã£ãª/ãããªãããŒããã£ã¹ãã確èªã§ããŸãã ãã©ãŠã¶ã®ã¢ãã¬ã¹httpïŒ// <IP phone>ïŒ<port>ã§ãããŒããã£ã¹ãIPãŠã§ãã«ã¡ã©ãéå§ãããšããã¹ããŒããã©ã³ã«ã¡ã©ãµãŒãã¹ããå©çšå¯èœã«ãªããŸãã ããã§ã¯ãåã ã®ãã¬ãŒã ã衚瀺ãããããªãšãµãŠã³ãã®åçãæå¹ã«ããããšãã§ããŸãã ããšãã°ãVLCã¡ãã£ã¢ãã¬ãŒã€ãŒã§ãããªã¹ããªãŒã ã衚瀺ããã«ã¯ãURL httpïŒ// <phone IP>ïŒ<port> / videofeedãéãå¿ èŠããããŸãã ãªãŒãã£ãªã®åçã«ã¯ãhttpïŒ// <phone IP>ïŒ<port> /audio.wavãšhttpïŒ// <phone IP>ïŒ<port> /audio.oggã®2ã€ã®URLã䜿çšã§ããŸãã ãµãŠã³ãã«ã¯ããªãã®é 延ããããŸãããåŸã§å€æããããã«ãããã¯åçäžã®ãã£ãã·ã¥ã«ãããã®ã§ãã VLCã¡ãã£ã¢ãã¬ãŒã€ãŒã§ã¯ããã£ãã·ã¥ã20ããªç§ã«èšå®ã§ãããµãŠã³ãã®é 延ã¯ãããã«ãªããŸãã
ããã¯è¯ããã¥ãŒã¹ã§ãããä»ã§ã¯æªããã¥ãŒã¹ã§ããããã¡ãããç§ã¯å°é£ãèŠã€ããŸããã ããã¯ã°ã©ãŠã³ãã§ããã€ã¹äžã§ãIP Webcamããããªã®ãããŒããã£ã¹ããåæ¢ããŸããã Google Playã®ã³ã¡ã³ããèªãã§ãããã4çªç®ã®Androidã®ãã¹ãŠã®ã©ãããŒãªäººã«èµ·ããããšãããããŸããã 3æ¥ã«ã€ããŠã¯ç¥ããŸããã ãããŠãIPãŠã§ãã«ã¡ã©ã®ãçºèŠãã®å°ãåã«ãAndroidã®ããŒãžã§ã³ã2.3.4ãã4.0.3ã«æŽæ°ããŸããã ããã¯ã°ã©ãŠã³ãã®äœæ¥ãäžå¯èœã§ããããšã¯èŽåœçã§ããããããªãæŸéããã¢ã¯ãã£ããã£ãéãããŸãŸã«ããŠããããšãã§ããªãã£ãããã§ãã éå£ãã¢ã¯ãã£ãã«ãããšãIP Webcamã¢ã¯ãã£ããã£ãããã¯ã°ã©ãŠã³ãã«ãªãããããŒããã£ã¹ããåæ¢ããŸããã ã¯ãããããããå¶åŸ¡ããã¢ããªã±ãŒã·ã§ã³ã®ãã®éšåã¯ããµãŒãã¹ãšããŠæŽçã§ããŸãããããã£ã¢ã®é¡ã¯ã©ãã§ããïŒ
èªåã§è§£æ±ºçãèŠã€ããããªãã£ãã®ã§ãIP Webcamãããžã§ã¯ãã®äœè ã«æçŽãæžãããšã«ããŸããã èè ã¯ãç§ãã¡ãã§ãããæžããšããæå³ã§ã¯ãã·ã¢èªã§ãããã 次ã®3ã€ã®ããšãæ°ã«ãªããŸããã
- ããã¯ã°ã©ãŠã³ãã§ãããŒããã£ã¹ããåæ¢ããŸãã
- ç»åããã®é³ã®é ãã
- IP Webcamã§é»è©±ã®IPã¢ãã¬ã¹ã誀ã£ãŠè¡šç€ºãããŸããã ããã¯éèŠã§ã¯ãããŸããããæåã¯æ··ä¹±ããŸãã ããã¯ãã³ã»ã³ã¹ã§ã¯ãããŸãããããã§ã®è³ªåã¯é»è©±ç»é¢ã®ééã£ãããã¹ãã«ã®ã¿ãããŸãã
IP Webcamã®äœè ïŒPavel KhlebovichïŒã«æè¬ããŸãã å¥ã®çŽ æŽãããäŒè°ã ç§ãã¡ããã®éä¿¡äžã«ã圌ã¯ç§ã®ãã¹ãŠã®è³ªåã«çããã ãã§ãªããå¥ã®ãã¢ãããžã§ã¯ããéä¿¡ããŸãããããã¯ãããã¯ã°ã©ãŠã³ãã¢ãŒããšç§ã®Android 4.0.3ã䜿çšããæ¹æ³ã瀺ããŠããŸãã
ãã¡ããäœããããæåã®2ã€ã®è³ªåãå¿é ã§ããã 2ã€ç®ã¯ãPavelããã©ãŠã¶ãšVLCã¡ãã£ã¢ãã¬ãŒã€ãŒã§ãµãŠã³ãããã£ãã·ã¥ããããšã«ã€ããŠãã¹ãŠãæããŠãããŸããã
ãããŠãããã«åœŒãæåã®è³ªåã§ç§ã«æžãããã®ããããŸãïŒããã¹ãŠã®4.xé»è©±ã¯ãã§ã«V4Lãã©ã€ãã䜿çšããŠããããã§ãã ãããã£ãŠãããã¯ã°ã©ãŠã³ãã§ã¯ããããªã¯æ©èœããŸããã åé¿çãšããŠãèªåã®ã¢ã¯ãã£ããã£ã®äžã«ç¬èªã®ãã®ãäœæããIP Webcamã®è¡šé¢ãç Žå£ãããªãããã«åéæã§ãããšèª¬æããããšãã§ããŸãããå®éã¯äžéæã«ããŠå¿ èŠãªãã®ã衚瀺ããŸãã
ç解ããããããã«æããŸãããããã¢ã¯ãã£ããã£ãå¥ã®ã¢ã¯ãã£ããã£ãããéããšãäž¡æ¹ãæ©èœããããã«ãªããŸãã åäœæéãããã¢ã¯ãã£ãã«ã§ããã¢ã¯ãã£ããã£ã¯1ã€ã ãã ãšæã£ãŠããŸããïŒãããã¯æ®å¿µã§ãïŒã ç§ã¯ããã€ãã®å®éšãè¡ããŸãããããäœããã¢ã¯ãã£ããã£ã§ã¯åžžã«onPauseãããªã¬ãŒãããŸããã ããã«ã¯åã³å©ããŠãããŸããã圌ã¯ç§ã®ããã«ç¹å¥ã«ãã¢ãããžã§ã¯ããäœæããŸããã é©ãã¹ãããšã«ã1ã€ã®ã¢ã¯ãã£ããã£ãå¥ã®ã¢ã¯ãã£ããã£ã®äžã«é 眮ãããšããã¢ã€ãã¢ã¯æ©èœããŸãã Pavelã®ãã¢ãããžã§ã¯ããïŒçŸå®¹çã«ïŒå°ãå€æŽããŠãRobot Mityaã®Webãµã€ãã«æçš¿ããŸããã
ãã®ãã¢ã§è¡ãããããšã説æããŸãã
1. Button1ãã¡ã€ã³ã¢ã¯ãã£ããã£ã®ã¬ã€ã¢ãŠãã«è¿œå ãããŸããã
2.ç»åââãsome_picture.pngããå«ãå¥ã®ã¬ã€ã¢ãŠããimageoverlay.xmlããè¿œå ããŸããã ãã以äžã®ãã®ã¯ãããŸããã
3. imageoverlay.xmlã³ã³ãã³ãã衚瀺ããOverlayActivity.javaãè¿œå ããŸããã IP Webcamãããªã®äžéšã«è¡šç€ºãããã®ã¯ãã®ã¢ã¯ãã£ããã£ã§ãã ç§ã®ã¡ã€ã³ãããžã§ã¯ãã§ã¯ããã®å Žæã§ãããããã¢ã¯ãã£ãã«ããã¢ã¯ãã£ããã£ããããŸãã 圌女ã¯ããã£ã¢ã®é¡ã§ãã
4.ãããã§ã¹ãã«æ¬¡ãè¿œå ããå¿ èŠããããŸãã
aïŒOverlayActivityã®èª¬æïŒ
<activity android:name="OverlayActivity" android:launchMode="singleInstance" android:theme="@android:style/Theme.Dialog"> </activity>
launchModeããã³themeå±æ§ã«ã¯ãæå®ãããå€ãå ¥åããå¿ èŠããããŸãã
bïŒããã€ã¹ã®ã«ã¡ã©ã«ã¢ã¯ã»ã¹ããæš©å©ïŒ
<uses-permission android:name="android.permission.CAMERA"/>
5. MainActivity.javaãè£è¶³ããŸãã
package ru.ipwebcam.android4.demo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { static String TAG = "IP Webcam demo"; Handler h = new Handler(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button videoButton = (Button)findViewById(R.id.button1); videoButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent launcher = new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME); Intent ipwebcam = new Intent() .setClassName("com.pas.webcam", "com.pas.webcam.Rolling") .putExtra("hidebtn1", true) // Hide help button .putExtra("caption2", "Run in background") // Change caption on "Actions..." .putExtra("intent2", launcher); // And give button another purpose h.postDelayed(new Runnable() { public void run() { startActivity(new Intent(MainActivity.this, OverlayActivity.class)); Log.i(TAG, "OverlayActivity started"); } }, 4000); startActivityForResult(ipwebcam, 1); h.postDelayed(new Runnable() { public void run() { sendBroadcast(new Intent("com.pas.webcam.CONTROL").putExtra("action", "stop")); Log.i(TAG, "Video is stopped"); } }, 20000); Log.i(TAG, "Video is started"); } }); } }
ãã¿ã³ãã¯ãªãã¯ãããšãIP Webã«ã¡ã©ãèµ·åãã4ç§åŸã«åçä»ãã®ã¢ã¯ãã£ããã£ããã®äžã«éããŸãã äž¡æ¹ã®ã¢ã¯ãã£ããŒã·ã§ã³ã衚瀺ãããããã«ãç»åãµã€ãºã¯ç¹å¥ã«ç»é¢è§£å床ãããå°ãããªããŸãïŒå°ãªããšãHTC Sensationã®å ŽåïŒã ãããŠãèµ·ååŸ20ç§ã§ãããã¯ã°ã©ãŠã³ãã§ã®IPãŠã§ãã«ã¡ã©ã¯åäœãåæ¢ããŸããããã¡ã€ã³ãã¢ã¯ãã£ããã£ã¯åäœãç¶ããŸãã
é»è©±ã§ã®è¡šç€ºã¯æ¬¡ã®ãšããã§ãã
ãã®åŸãMityaã®Androidã¢ããªã±ãŒã·ã§ã³ãå°ãå€æŽããã ãã§ãPCã®ãã©ãŠã¶ãŒã§ã«ã¡ã©ã§ããã確èªãããã€ã¯ã§ãããèãããšãã§ããŸããã
Windowsã¢ããªã±ãŒã·ã§ã³ã§ãããªãåçãã
ããã«ã€ããŠã¯ä»¥åã¯èããŠããŸããã§ãããããã®æ®µéã§åããŠIP Webcamã®ãããªã¯å®éã«ã¯ãããªã§ã¯ãªãããšã«æ°ä»ããŸããã ããã¯MJPEGã§ãã ã€ãŸã ãããŒããã£ã¹ãã¹ããªãŒã ã¯ãJPEG圢åŒã®ãã¬ãŒã ã®é 次éä¿¡ã§ãã ç§ã¯ããããªäŒéã«é¢é£ããåé¡ãéåžžã«åŒ±ããããMJPEGããã®ä¿ææ§ã¯æåŸ ããŠããŸããã§ããã ãããŠç¡é§ã«-çµæã¯ç§ã«éåžžã«é©ããŠããŸããã
MJPEGã¹ããªãŒã ãåçããããã«ããã°ãããç¡æ補åMJPEG DecoderãèŠã€ããŸããã MJPEGã衚瀺ããæ段ã®æ€çŽ¢ã¯ãWindows Mitya管çã¢ããªã±ãŒã·ã§ã³ãXNAãã¬ãŒã ã¯ãŒã¯ã䜿çšãããšããäºå®ã«ããè€éã«ãªããŸããã MJPEG Decoderã¯XNA 4.0ããµããŒãããWinFormsãWPFãSilverlightãããã³Windows Phone 7ã¢ããªã±ãŒã·ã§ã³ã§ãåäœããŸãã
Mityaã®ãœãŒã¹ã¯ãŸã éããŠããŸããããã¹ãŠãããããããã®ã§ãããã§ã¯XNAã¢ããªã±ãŒã·ã§ã³ã§MJPEG Decoderã䜿çšããŠIP Webcamãããããªã¹ããªãŒã ãåçãããã¢äŸã玹ä»ããŸãã 次ã®ã»ã¯ã·ã§ã³ã§ã¯ãIP WebcamãããµãŠã³ããåçããããã®ã³ãŒãã§ãã®äŸãè£è¶³ããŸãã
ããã§ãWindows GameïŒ4.0ïŒãããžã§ã¯ããäœæããŸãã ã©ã€ãã©ãªãMjpegProcessorXna4ãããã®ãããžã§ã¯ãã®ãªã³ã¯ã«è¿œå ããŸãïŒ ãããžã§ã¯ãWebãµã€ããŸãã¯é±å±±ããããŠã³ããŒãããŸãïŒã
Game1.csãã¡ã€ã«ã§ãMjpegProcessoråå空éã®äœ¿çšã宣èšããŸãã
using MjpegProcessor;
ãã©ã€ããŒãmjpegãã£ãŒã«ãã宣èšããŸãã
private MjpegDecoder mjpeg;
ãããªåºåã®ãã¯ã¹ãã£ã宣èšããŸãïŒ
private Texture2D videoTexture;
Initializeã¡ãœãããè£è¶³ããŸãã
this.mjpeg = new MjpegDecoder();
Updateã¡ãœãããè£è¶³ããŸãã
1.ã¹ããŒã¹ããŒãæŒããšããããªã¹ããªãŒã ã®åçãéå§ãããŸãã
this.mjpeg.ParseStream(new Uri(@"http://192.168.1.40/videofeed"));
2. EscãæŒããšãåçãåæ¢ããŸãã
this.mjpeg.StopStream();
3. UpdateãåŒã³åºããšãã«ã次ã®ãã¬ãŒã ãåãå ¥ããŸãã
this.videoTexture = this.mjpeg.GetMjpegFrame(this.GraphicsDevice);
Drawã¡ãœãããè£è¶³ããŸãã
if (this.videoTexture != null) { this.spriteBatch.Begin(); Rectangle rectangle = new Rectangle( 0, 0, this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight); this.spriteBatch.Draw(this.videoTexture, rectangle, Color.White); this.spriteBatch.End(); }
ã»ãšãã©ãã¹ãŠã§ãã ã»ãšãã©ãã¹ãŠããã§ã«æ©èœããŠãããããåçäžã®ãã¬ãŒã ã¯ã»ãšãã©å€åããªãããã§ãã ç§ã¯1ã2ç§ããšã«ãããæã£ãŠããŸãã ãããä¿®æ£ããã«ã¯ã次ã®ããã«ã¯ã©ã¹ã³ã³ã¹ãã©ã¯ã¿ãŒãä¿®æ£ããŸãã
public Game1() { this.IsFixedTimeStep = false; this.graphics = new GraphicsDeviceManager(this); this.graphics.SynchronizeWithVerticalRetrace = false; Content.RootDirectory = "Content"; }
Game1.csãã¡ã€ã«ã®å 容ã¯ãã¹ããªãŒãã³ã°ãªãŒãã£ãªåçã³ãŒãã§è£è¶³ãããšãã«ã次ã®ã»ã¯ã·ã§ã³ã®æåŸã§æäŸããŸãã
Windowsã¢ããªã±ãŒã·ã§ã³ã§ãµãŠã³ããåçãã
æšæºã®XNAãŸãã¯.NETããŒã«ã䜿çšããŠIP WebcamãããªãŒãã£ãªã¹ããªãŒã ãåçããæ¹æ³ãèŠã€ããããšãã§ããŸããã§ããã ãaudio.wavãããaudio.oggãããããŸããã XNAãã¬ãŒã ã¯ãŒã¯ã®éçMediaPlayerã¯ã©ã¹ã䜿çšããŠã¹ããªãŒãã³ã°ãªãŒãã£ãªãåçãããäŸãèŠã€ããŸããããç§ãã¡ã®ã¹ããªãŒã ã¯åœŒã«ãšã£ãŠã¯åŒ·ãããŸããã
NAUDIOããã³SlimDXãããžã§ã¯ããéãããã®Webäžã®å€ãã®ãªã³ã¯ã ããããæåã¯ãã¢ã¢ããªã±ãŒã·ã§ã³ãèµ·åããŸããããããã倱æãã2çªç®ã¯ãã¹ã¿ãŒããŸããã§ããã ç§ã¯æ¬åœã«DirectXã¬ãã«ãŸã§ã¹ã©ã€ãããŠã³ããããããŸããã§ããã å¶ç¶ãçŽ æŽãããæ¹æ³ãèŠã€ããŸããã éåžžã«åãçŽ æŽãããVLCã¡ãã£ã¢ãã¬ãŒã€ãŒãšå ±ã«ActiveXã©ã€ãã©ãªãä»å±ããŠããããšãããããŸããã ã€ãŸã Windowsã§ã¯ãCOMã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŠVLCãæäœã§ããŸãã ã€ã³ã¿ãŒãã§ã€ã¹ã®èª¬æã¯éåžžã«æå³ãé«ããVLCãããžã§ã¯ãã®WLCã«ã¯äžè¬çã«å€ãæ å ±ãå«ãŸããŠããŸãã äžå¿«ã§ããããã¹ãŠãããŸããããŸããã
ActiveXã©ã€ãã©ãªã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããã«ã¯ãæåã«ç»é²ããå¿ èŠããããŸãã VLCã¡ãã£ã¢ãã¬ãŒã€ãŒãã€ã³ã¹ããŒã«ãããšãç»é²ããããç§ãç解ããããã«ãVlcãã©ã«ããŒã«éè·ã眮ãããŸãã ãããè¡ãã«ã¯ãã³ã³ãœãŒã«ïŒcmd.exeïŒãå®è¡ãã次ãå ¥åããŸãã
regsvr32 "c:\Program Files (x86)\VideoLAN\VLC\axvlc.dll"
ãã¡ããããã¹ãæå®ããŸãã Windows VistaãŸãã¯Windows 7ã䜿çšããŠããå Žåã¯ã管çè ãšããŠã³ã³ãœãŒã«ãå®è¡ããŸãã
ããã§ãIP Webcamã®ãµãŠã³ããã©ãããã§ãåçã§ããŸãã Excelã§ãã¬ãŒãã³ã°ããŸããã VBScriptã§ã¯å¯èœã§ãããVBAã¯ã©ã¹ã§ã¯ãã¡ã³ããŒã¯ããã³ããã§ã¯ããŒã«ããŸãã å¿ èŠã«å¿ããŠãç°¡åãªäŸã瀺ããŸãã ExcelãéããAlt + F11ãæŒããŸãã Microsoft Visual Basic for ApplicationsãŠã£ã³ããŠã§ãã¡ãã¥ãŒããŒã«->åç §...ãªã³ã¯ããVideoLAN VLC ActiveXãã©ã°ã€ã³ãã«æ¥ç¶ããŸãã ããã§ãã¢ãžã¥ãŒã«ãè¿œå ããããã«ãã¯ãããã¹ããå ¥åã§ããŸãã
Sub TestAxLib() Dim vlc As New AXVLC.VLCPlugin2 vlc.Visible = False vlc.playlist.items.Clear vlc.AutoPlay = True vlc.Volume = 200 vlc.playlist.Add "http://192.168.1.40:8080/audio.wav", Null, Array(":network-caching=5") vlc.playlist.playItem (0) MsgBox "Hello world!" vlc.playlist.stop End Sub
IP Webcamãèµ·åãããã¯ããå®è¡ããŸã-é³ãããŸãïŒ ãšããã§ããããªãåçããããšãã§ããŸãã
ãã¹ãXNAã¢ããªã±ãŒã·ã§ã³ã«æ»ããã¹ããªãŒãã³ã°ãµãŠã³ããåçããã«ã¯ã次ã®æé ãå®è¡ããŸãã
ãããžã§ã¯ãã®COMã³ã³ããŒãã³ããVideoLAN VLC ActiveXãã©ã°ã€ã³ããžã®ãªã³ã¯ãè¿œå ããŸãã ããœãªã¥ãŒã·ã§ã³ãšã¯ã¹ãããŒã©ãŒãã§ã¯ããAXVLCããšè¡šç€ºãããŸãã ãAXVLCããªã³ã¯ãéžæãããããããã£ããŠã£ã³ããŠã§ãçžäºäœçšã¿ã€ããåã蟌ããããããã£ãFalseã«èšå®ããŸãã
AXVLCåå空éã®äœ¿çšã宣èšããŸãã
using AXVLC;
ãªããžã§ã¯ãã®å®£èšïŒ
private AXVLC.VLCPlugin2 audio;
Initializeã¡ãœãããè£å®ããŸãã
this.audio = new AXVLC.VLCPlugin2Class();
æŽæ°æ¹æ³ãè£è¶³ããŸãã
1.ã¹ããŒã¹ããŒãæŒããšããªãŒãã£ãªã¹ããªãŒã ã®åçãéå§ãããŸãã
this.audio.Visible = false; this.audio.playlist.items.clear(); this.audio.AutoPlay = true; this.audio.Volume = 200; string[] options = new string[] { @":network-caching=20" }; this.audio.playlist.add( @"http://192.168.1.40:8080/audio.wav", null, options); this.audio.playlist.playItem(0);
2. EscãæŒãããšã«ããããªãŒãã£ãªã¹ããªãŒã ã®åçãåæ¢ããŸãã
if (this.audio.playlist.isPlaying) { this.audio.playlist.stop(); }
ã ããããã«ããªããåŸãã¹ããã®ããããŸãïŒ
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using AXVLC; using MjpegProcessor; namespace WindowsGame1 { /// <summary> /// . /// </summary> public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; /// <summary> /// . /// </summary> private Texture2D videoTexture; /// <summary> /// MJPEG. /// (, MJPEG), IP Webcam. /// </summary> /// <remarks> /// .NET "MjpegProcessorXna4". /// </remarks> private MjpegDecoder mjpeg; /// <summary> /// VLC. /// , IP Webcam. /// </summary> /// <remarks> /// ActiveX- VLC (www.videolan.org). /// VLC, ActiveX- axvlc.dll, COM- "VideoLAN VLC ActiveX Plugin" ( "AXVLC"). /// </remarks> private AXVLC.VLCPlugin2 audio; /// <summary> /// . /// </summary> public Game1() { this.IsFixedTimeStep = false; this.graphics = new GraphicsDeviceManager(this); this.graphics.SynchronizeWithVerticalRetrace = false; Content.RootDirectory = "Content"; } /// <summary> /// . /// </summary> protected override void Initialize() { base.Initialize(); // : this.mjpeg = new MjpegDecoder(); // COM- : this.audio = new AXVLC.VLCPlugin2Class(); } /// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); } /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // : if (Keyboard.GetState().IsKeyDown(Keys.Space)) { // : this.mjpeg.ParseStream(new Uri(@"http://192.168.1.40:8080/videofeed")); // : this.audio.Visible = false; this.audio.playlist.items.clear(); this.audio.AutoPlay = true; this.audio.Volume = 200; string[] options = new string[] { @":network-caching=20" }; this.audio.playlist.add( @"http://192.168.1.40:8080/audio.wav", null, options); this.audio.playlist.playItem(0); } // Esc : if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { // : this.mjpeg.StopStream(); // : if (this.audio.playlist.isPlaying) { this.audio.playlist.stop(); } } // : this.videoTexture = this.mjpeg.GetMjpegFrame(this.GraphicsDevice); base.Update(gameTime); } /// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); if (this.videoTexture != null) { this.spriteBatch.Begin(); Rectangle rectangle = new Rectangle( 0, 0, this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight); this.spriteBatch.Draw(this.videoTexture, rectangle, Color.White); this.spriteBatch.End(); } base.Draw(gameTime); } } }
ãŸãšã
ãã®æ®µéãçµããŠãæè¡çãªçµè«ãšéæè¡çãªçµè«ã®äž¡æ¹ããããŸããã
ããã§ãå人ã¯å®¶ãåºãã«ããã£ã¢ã®ãã¢ããŒããå ã®ç§ã®ã¢ããŒããæ ããããšãã§ããŸãã ããæ£ç¢ºã«ã¯ãã²ãŒã ããããããã°å¯èœã§ãã ãã人æ°ã®ããå ¥åããŒã«ãäœæããããšã«æåããããã§ãã
ããã£ã¢ã¯ãã¹ãŠãèŠãŠèããŠããŸãããäœãèšããŸããã ãŸãã圌ã®é¡ã®è¡šæ ãåºãããã¯ããããããããããå°Ÿãæ¯ãããªã©ã®åºæ¬çãªãžã§ã¹ãã£ãŒãæããå¿ èŠããããŸãã 次ã«ããªãã¬ãŒã¿ãããããããŸã§ãå察æ¹åã«ãµãŠã³ããåçããå¿ èŠããããŸãã
ãã1ã€ã®çåã¯ãããã£ã¢ã®é ãé§åããåçŽãµãŒãã®çµ¶ãéãªããã¶ãŒé³ã®åäœã§ãã é»è©±ã®ééã«ããããµãŒããã©ã€ãã¯æå®ã®è§åºŠãç¶æããããã«åŒ·å¶ããã絶ããããã³ã°ãšåŸ®æ¯åãç¶ããŠããŸãã ããã¯ãããªã«ã¯åœ±é¿ããŸãããããã€ã¯ãç®è©°ãŸãããŸãã ãã®çµæããªãã¬ãŒã¿ãŒã«ã¯ãããªãé³ä»¥å€ã¯äœãèãããŸããã é ã®ããäœçœ®ã§ã¯ãé³ãæ¢ãŸãããã¹ãŠãå®å šã«èãããŸãã ãã®åé¡ã解決ããæ¹æ³ããç¥ããŸããã
ç§ã®éæè¡çãªçµéšã¯ã趣å³ã®æ°ããåŽé¢ãçºèŠããããšã§ãã é ã«ç«ã£ãŠãããã£ã¢ã®ããããã¯èªåã®äººçãçããŠããããã§ãã圌ã¯ç§ã«èå³ãæã¡ãããã€ãã®ç¹ã§ç§ã«éåžžã«äŒŒãŠãã人ã ã«ç§ã玹ä»ããŸãããŸã ãã®ãããžã§ã¯ãã«ã ç§ã¯ç²Ÿç¥ç§å»ãããªãããšãé¡ã£ãŠããŸã...äžèšã§èšãã°ãç§ã¯å€æ¹ã®åš¯æ¥œãããã®ãããªåŸ©åž°ãæåŸ ããŠããŸããã§ããïŒç§ã®åŽãšããã£ãã®äž¡æ¹ã§ïŒã
ãããŠãããã«ç§ãæãåºãããšããå¥ã®çµè«ããããŸãã åå©ã»ã©åæ©ä»ãããããã®ã¯ãªãããšãå®å šã«ç解ããŠããŸãã ãããŠãäœãåå©ã®é·ãäžåšã»ã©èå³ã殺ããŸããã 誰ããç§ã®ãããªé åºãªéå±ããæã£ãŠãããšã¯éããŸããã ãããŠãç§ããã®ãã¹ãŠãèœãšã寞åã§ããã åœåã®éãç§ã¯å¥ã®ãããžã§ã¯ããåãäžããããããäŒæ©ãåã£ãŠãããééããªãæ»ããšèªåã«èšããŸããã ããããæ·±ãç§ã¯ãããäœãæå³ããããç¥ã£ãŠããŠããã®è§åºŠã調ã¹ãªãããã«ããŸããã ãããªã®éä¿¡ã®åé¡ã解決ããããšã¯ããã®ãããžã§ã¯ãã§ã®ç§ã«ãšã£ãŠå€§ããªäžæ©ã§ããããããŠãç§ã¯ãã倧ããªäžæ©ãèžã¿åºããªãããã«ããŸãã 倧ããªäžæ©ã¯å€§ããªãªã¹ã¯ã§ãã å¥ã®ä»äºã«å°±ããšããã ã£ãã®ã§ãããé åçã«æããŸããããä»ã§ã¯ãã®ããšããèŠããŠããŸããã ç§ã®é ã®äžã§ã¯ãããã£ã¢ã®èšç»ã倧å¢ããŸãã ã ããä»ãç§ã¯èªåã§å°ããªã¿ã¹ã¯ãèšå®ããŸãã ããããã®åå©ãæãã§ããŸããããã¯ç§ã®åã³ã®ç³§ã§ãïŒ å°æ¥ã¯å€§ããªåå©ãªãã§ããããšæããŸãã ç§ã¯ããããã®å°ããªãã®ãéžã³ãŸãã