walkor / live-camera Goto Github PK
View Code? Open in Web Editor NEWLive camera based on HTML5+Canvas+Websocket+PHP (Workerman).
License: MIT License
Live camera based on HTML5+Canvas+Websocket+PHP (Workerman).
License: MIT License
一直折腾不好,求详细教程。
当网页通过websocket接收的图片数据,加载到img标签中时,网页内存占用率一直在增加,楼主有没有遇到这个问题,怎么解决的呢?
有明显卡顿,延迟,虽然知道这是个老项目了
本地虚拟机CentOS 7,部署到服务器中时,关闭防火墙可以正常直播和观看,但是开启防火墙甚至设置防火墙规则就不行,观看页面无法收到数据。(没有更改代码的前提下,开放了8080和8088端口)
部署到阿里云的服务器上时,就算我完全关闭了防火墙,观看页面也无法显示视频。
手机firefox进行拍摄,WEB端看到的视频是倒着的,求大神解释下这个。
cd /Users/ding/Desktop/live-camera
php start.php start
php -v
PHP 5.4.45 (cli) (built: Mar 29 2016 17:30:14)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
然后临时有事情走开了。
一个多小时后回来,我mac就报磁盘空间不足,我就奇了怪了,之前看还有一百多G,
于是查看了下,开始以为mac的bug。因为Machintosh HD 管理显示系统用了188G,然后过一会看,190G,就说明还在持续增加中。。。
后来,我找到/private/var/tmp/ 这个目录下占了一百多G,类似于/private/var/tmp/script.00785e 这类文件。
查了内容,就是一些xdebug对应php的信息,应该是调试信息吧
最后直接清掉/private/var/tmp/目录下的所有文件就搞定了。然后想起php相关的就是跑了下live-camera。
停止后没有问题了。
举个例子:
cat /private/var/tmp/script.0a6c3e
version: 1
creator: xdebug 2.4.0 (PHP 5.4.45)
cmd: /Users/ding/Desktop/live-camera/start.php
part: 1
positions: line
events: Time
fl=(1) php:internal
fn=(1) php::ini_set
7 35
fl=(1)
fn=(2) php::extension_loaded
11 5
fl=(1)
fn=(2)
16 1
fl=(1)
fn=(3) php::define
22 7
fl=(2) /Users/ding/Desktop/live-camera/vendor/composer/autoload_real.php
fn=(4) require_once::/Users/ding/Desktop/live-camera/vendor/composer/autoload_real.php
1 1
fl=(1)
fn=(5) php::spl_autoload_register
22 15
fl=(3) /Users/ding/Desktop/live-camera/vendor/composer/ClassLoader.php
fn=(6) require::/Users/ding/Desktop/live-camera/vendor/composer/ClassLoader.php
1 4
fl=(2)
fn=(7) ComposerAutoloaderInitfb08c126c19c89df75aebba48dccbebb::loadClassLoader
9 3036
cfl=(3)
cfn=(6)
calls=1 0 0
12 4
fl=(1)
fn=(8) php::spl_autoload_unregister
24 4
fl=(1)
fn=(9) php::dirname
5 5
fl=(1)
fn=(9)
5 0
fl=(1)
fn=(9)
6 0
fl=(4) /Users/ding/Desktop/live-camera/vendor/composer/autoload_namespaces.php
fn=(10) require::/Users/ding/Desktop/live-camera/vendor/composer/autoload_namespaces.php
1 46
cfl=(1)
cfn=(9)
calls=1 0 0
5 5
cfl=(1)
cfn=(9)
calls=1 0 0
5 0
cfl=(1)
cfn=(9)
calls=1 0 0
6 0
fl=(1)
fn=(9)
5 0
fl=(1)
fn=(9)
5 0
fl=(1)
fn=(9)
6 0
fl=(5) /Users/ding/Desktop/live-camera/vendor/composer/autoload_psr4.php
fn=(11) require::/Users/ding/Desktop/live-camera/vendor/composer/autoload_psr4.php
1 47
cfl=(1)
cfn=(9)
calls=1 0 0
5 0
cfl=(1)
cfn=(9)
calls=1 0 0
5 0
cfl=(1)
cfn=(9)
calls=1 0 0
6 0
fl=(1)
fn=(12) php::strlen
223 0
fl=(3)
fn=(13) Composer\Autoload\ClassLoader->setPsr4
218 49
cfl=(1)
cfn=(12)
calls=1 0 0
223 0
fl=(1)
fn=(9)
5 0
fl=(1)
fn=(9)
5 0
fl=(1)
fn=(9)
6 0
fl=(6) /Users/ding/Desktop/live-camera/vendor/composer/autoload_classmap.php
fn=(14) require::/Users/ding/Desktop/live-camera/vendor/composer/autoload_classmap.php
1 40
cfl=(1)
cfn=(9)
calls=1 0 0
5 0
cfl=(1)
cfn=(9)
calls=1 0 0
5 0
cfl=(1)
cfn=(9)
calls=1 0 0
6 0
fl=(1)
fn=(5)
281 5
fl=(3)
fn=(15) Composer\Autoload\ClassLoader->register
279 20
cfl=(1)
cfn=(5)
calls=1 0 0
281 5
fl=(2)
fn=(16) ComposerAutoloaderInitfb08c126c19c89df75aebba48dccbebb::getLoader
16 532
cfl=(1)
cfn=(5)
calls=1 0 0
22 15
cfl=(2)
cfn=(7)
calls=1 0 0
23 3040
cfl=(1)
cfn=(8)
calls=1 0 0
24 4
cfl=(4)
cfn=(10)
calls=1 0 0
32 52
cfl=(5)
cfn=(11)
calls=1 0 0
37 48
cfl=(3)
cfn=(13)
calls=1 0 0
39 50
cfl=(6)
cfn=(14)
calls=1 0 0
42 42
cfl=(3)
cfn=(15)
calls=1 0 0
48 25
fl=(7) /Users/ding/Desktop/live-camera/vendor/autoload.php
fn=(17) require_once::/Users/ding/Desktop/live-camera/vendor/autoload.php
1 795
cfl=(2)
cfn=(4)
calls=1 0 0
5 1
cfl=(2)
cfn=(16)
calls=1 0 0
7 3809
fl=(1)
fn=(18) php::glob
27 128
fl=(1)
fn=(19) php::strtr
347 5
fl=(1)
fn=(20) php::strpos
352 0
fl=(1)
fn=(21) php::substr
354 3
fl=(1)
fn=(22) php::file_exists
354 12
fl=(3)
fn=(23) Composer\Autoload\ClassLoader->findFileWithExtension
344 77
cfl=(1)
cfn=(19)
calls=1 0 0
347 5
cfl=(1)
cfn=(20)
calls=1 0 0
352 0
cfl=(1)
cfn=(21)
calls=1 0 0
354 3
cfl=(1)
cfn=(22)
calls=1 0 0
354 12
fl=(3)
fn=(24) Composer\Autoload\ClassLoader->findFile
314 106
cfl=(3)
cfn=(23)
calls=1 0 0
329 99
fl=(1)
fn=(19)
347 3
fl=(1)
fn=(20)
352 0
fl=(1)
fn=(21)
354 0
fl=(1)
fn=(22)
354 15
fl=(3)
fn=(23)
344 77
cfl=(1)
cfn=(19)
calls=1 0 0
347 3
cfl=(1)
cfn=(20)
calls=1 0 0
352 0
cfl=(1)
cfn=(21)
calls=1 0 0
354 0
cfl=(1)
cfn=(22)
calls=1 0 0
354 15
fl=(3)
fn=(24)
314 82
cfl=(3)
cfn=(23)
calls=1 0 0
329 97
fl=(1)
fn=(25) php::ini_get
16 1
fl=(1)
fn=(1)
20 1
fl=(1)
fn=(26) php::error_reporting
22 3
fl=(1)
fn=(3)
25 2
fl=(1)
fn=(3)
27 0
fl=(1)
fn=(19)
347 1
fl=(1)
fn=(27) php::strrpos
370 1
fl=(1)
fn=(19)
376 0
fl=(3)
fn=(23)
344 52
cfl=(1)
cfn=(19)
calls=1 0 0
347 1
cfl=(1)
cfn=(27)
calls=1 0 0
370 1
cfl=(1)
cfn=(19)
calls=1 0 0
376 0
fl=(1)
fn=(28) php::defined
332 0
fl=(3)
fn=(24)
314 82
cfl=(3)
cfn=(23)
calls=1 0 0
329 56
cfl=(1)
cfn=(28)
calls=1 0 0
332 0
fl=(3)
fn=(29) Composer\Autoload\ClassLoader->loadClass
298 29
cfl=(3)
cfn=(24)
calls=1 0 0
300 139
fl=(1)
fn=(30) php::class_exists
30 29
cfl=(3)
cfn=(29)
calls=1 0 0
30 169
fl=(8) /Users/ding/Desktop/live-camera/vendor/workerman/workerman/Lib/Constants.php
fn=(31) require_once::/Users/ding/Desktop/live-camera/vendor/workerman/workerman/Lib/Constants.php
1 116
cfl=(1)
cfn=(25)
calls=1 0 0
16 1
cfl=(1)
cfn=(1)
calls=1 0 0
20 1
cfl=(1)
cfn=(26)
calls=1 0 0
22 3
cfl=(1)
cfn=(3)
calls=1 0 0
25 2
cfl=(1)
cfn=(3)
calls=1 0 0
27 0
cfl=(1)
cfn=(30)
calls=1 0 0
30 198
fl=(9) /Users/ding/Desktop/live-camera/vendor/workerman/workerman/Worker.php
fn=(32) include::/Users/ding/Desktop/live-camera/vendor/workerman/workerman/Worker.php
1 427
cfl=(8)
cfn=(31)
calls=1 0 0
16 324
fl=(3)
fn=(33) Composer\Autoload\includeFile
410 2921
cfl=(9)
cfn=(32)
calls=1 0 0
412 751
fl=(3)
fn=(29)
298 54
cfl=(3)
cfn=(24)
calls=1 0 0
300 180
cfl=(3)
cfn=(33)
calls=1 0 0
301 3673
fl=(10) /Users/ding/Desktop/live-camera/vendor/workerman/workerman/WebServer.php
fn=(34) include::/Users/ding/Desktop/live-camera/vendor/workerman/workerman/WebServer.php
1 87
cfl=(3)
cfn=(29)
calls=1 0 0
23 3907
fl=(3)
fn=(33)
410 710
cfl=(10)
cfn=(34)
calls=1 0 0
412 3995
fl=(3)
fn=(29)
298 52
cfl=(3)
cfn=(24)
calls=1 0 0
300 205
cfl=(3)
cfn=(33)
calls=1 0 0
301 4706
fl=(1)
fn=(35) php::explode
66 7
fl=(1)
fn=(36) php::spl_object_hash
1374 29
fl=(1)
fn=(37) php::debug_backtrace
1379 12
fl=(1)
fn=(9)
1380 0
fl=(1)
fn=(38) php::stream_context_create
1388 8
fl=(9)
fn=(39) Workerman\Worker->__construct
1371 105
cfl=(1)
cfn=(36)
calls=1 0 0
1374 29
cfl=(1)
cfn=(37)
calls=1 0 0
1379 12
cfl=(1)
cfn=(9)
calls=1 0 0
1380 0
cfl=(1)
cfn=(38)
calls=1 0 0
1388 8
fl=(10)
fn=(40) Workerman\WebServer->__construct
64 76
cfl=(1)
cfn=(35)
calls=1 0 0
66 7
cfl=(9)
cfn=(39)
calls=1 0 0
67 156
fl=(10)
fn=(41) Workerman\WebServer->addRoot
53 3
fl=(1)
fn=(28)
28 1
fl=(11) /Users/ding/Desktop/live-camera/start_web.php
fn=(42) require_once::/Users/ding/Desktop/live-camera/start_web.php
1 102
cfl=(3)
cfn=(29)
calls=1 0 0
20 4965
cfl=(10)
cfn=(40)
calls=1 0 0
20 240
cfl=(10)
cfn=(41)
calls=1 0 0
24 3
cfl=(1)
cfn=(28)
calls=1 0 0
28 1
fl=(1)
fn=(36)
1374 2
fl=(1)
fn=(37)
1379 4
fl=(1)
fn=(9)
1380 0
fl=(1)
fn=(38)
1388 3
fl=(9)
fn=(39)
1371 76
cfl=(1)
cfn=(36)
calls=1 0 0
1374 2
cfl=(1)
cfn=(37)
calls=1 0 0
1379 4
cfl=(1)
cfn=(9)
calls=1 0 0
1380 0
cfl=(1)
cfn=(38)
calls=1 0 0
1388 3
fl=(1)
fn=(28)
40 1
fl=(12) /Users/ding/Desktop/live-camera/start_worker.php
fn=(43) require_once::/Users/ding/Desktop/live-camera/start_worker.php
1 64
cfl=(9)
cfn=(39)
calls=1 0 0
19 86
cfl=(1)
cfn=(28)
calls=1 0 0
40 1
fl=(1)
fn=(44) php::php_sapi_name
445 0
fl=(9)
fn=(45) Workerman\Worker::checkSapiEnv
442 24
cfl=(1)
cfn=(44)
calls=1 0 0
445 0
fl=(1)
fn=(37)
458 4
fl=(1)
fn=(46) php::count
459 3
fl=(1)
fn=(47) php::str_replace
463 10
fl=(1)
fn=(48) php::touch
471 44
fl=(1)
fn=(49) php::chmod
472 22
fl=(1)
fn=(50) php::time
478 1
fl=(1)
fn=(51) php::sys_get_temp_dir
479 5
fl=(1)
fn=(52) php::function_exists
999 0
fl=(1)
fn=(2)
1002 0
fl=(9)
fn=(53) Workerman\Worker::setProcessTitle
996 27
cfl=(1)
cfn=(52)
calls=1 0 0
999 0
cfl=(1)
cfn=(2)
calls=1 0 0
1002 0
fl=(9)
fn=(54) Workerman\Worker::initId
562 18
fl=(1)
fn=(19)
347 0
fl=(1)
fn=(20)
352 0
fl=(1)
fn=(21)
354 1
fl=(1)
fn=(22)
354 5
fl=(3)
fn=(23)
344 34
cfl=(1)
cfn=(19)
calls=1 0 0
347 0
cfl=(1)
cfn=(20)
calls=1 0 0
352 0
cfl=(1)
cfn=(21)
calls=1 0 0
354 1
cfl=(1)
cfn=(22)
calls=1 0 0
354 5
fl=(3)
fn=(24)
314 98
cfl=(3)
cfn=(23)
calls=1 0 0
329 42
fl=(13) /Users/ding/Desktop/live-camera/vendor/workerman/workerman/Lib/Timer.php
fn=(55) include::/Users/ding/Desktop/live-camera/vendor/workerman/workerman/Lib/Timer.php
1 0
fl=(3)
fn=(33)
410 334
cfl=(13)
cfn=(55)
calls=1 0 0
412 0
fl=(3)
fn=(29)
298 48
cfl=(3)
cfn=(24)
calls=1 0 0
300 141
cfl=(3)
cfn=(33)
calls=1 0 0
301 334
fl=(1)
fn=(56) php::pcntl_signal
57 23
fl=(13)
fn=(57) Workerman\Lib\Timer::init
52 28
cfl=(1)
cfn=(56)
calls=1 0 0
57 23
fl=(9)
fn=(58) Workerman\Worker::init
455 223
cfl=(1)
cfn=(37)
calls=1 0 0
458 4
cfl=(1)
cfn=(46)
calls=1 0 0
459 3
cfl=(1)
cfn=(47)
calls=1 0 0
463 10
cfl=(1)
cfn=(48)
calls=1 0 0
471 44
cfl=(1)
cfn=(49)
calls=1 0 0
472 22
cfl=(1)
cfn=(50)
calls=1 0 0
478 1
cfl=(1)
cfn=(51)
calls=1 0 0
479 5
cfl=(9)
cfn=(53)
calls=1 0 0
482 28
cfl=(9)
cfn=(54)
calls=1 0 0
485 18
cfl=(3)
cfn=(29)
calls=1 0 0
488 524
cfl=(13)
cfn=(57)
calls=1 0 0
488 51
fl=(1)
fn=(59) php::trim
630 0
fl=(1)
fn=(52)
1360 1
fl=(1)
fn=(60) php::posix_isatty
1360 8
fl=(9)
fn=(61) Workerman\Worker::safeEcho
1358 63
cfl=(1)
cfn=(52)
calls=1 0 0
1360 1
cfl=(1)
cfn=(60)
calls=1 0 0
1360 8
fl=(1)
fn=(62) php::date
1350 41
fl=(1)
fn=(63) php::posix_getpid
1350 0
fl=(1)
fn=(64) php::file_put_contents
1350 167
fl=(9)
fn=(65) Workerman\Worker::log
1344 89
cfl=(9)
cfn=(61)
calls=1 0 0
1348 72
cfl=(1)
cfn=(62)
calls=1 0 0
1350 41
cfl=(1)
cfn=(63)
calls=1 0 0
1350 0
cfl=(1)
cfn=(64)
calls=1 0 0
1350 167
fl=(1)
fn=(66) php::file_get_contents
645 70
fl=(1)
fn=(52)
1360 0
fl=(1)
fn=(60)
1360 4
fl=(9)
fn=(61)
1358 38
cfl=(1)
cfn=(52)
calls=1 0 0
1360 0
cfl=(1)
cfn=(60)
calls=1 0 0
1360 4
fl=(1)
fn=(62)
1350 6
fl=(1)
fn=(63)
1350 0
fl=(1)
fn=(64)
1350 102
fl=(9)
fn=(65)
1344 76
cfl=(9)
cfn=(61)
calls=1 0 0
1348 43
cfl=(1)
cfn=(62)
calls=1 0 0
1350 6
cfl=(1)
cfn=(63)
calls=1 0 0
1350 0
cfl=(1)
cfn=(64)
calls=1 0 0
1350 102
fl=(9)
fn=(67) Workerman\Worker::parseCommand
620 152
cfl=(1)
cfn=(59)
calls=1 0 0
630 0
cfl=(9)
cfn=(65)
calls=1 0 0
642 370
cfl=(1)
cfn=(66)
calls=1 0 0
645 70
cfl=(9)
cfn=(65)
calls=1 0 0
654 229
fl=(9)
fn=(68) Workerman\Worker::runAll
422 142
cfl=(9)
cfn=(45)
calls=1 0 0
424 25
cfl=(9)
cfn=(58)
calls=1 0 0
425 939
cfl=(9)
cfn=(67)
calls=1 0 0
426 823
fl=(14) /Users/ding/Desktop/live-camera/start.php
fn=(69) {main}
summary: 13161
1 980
cfl=(1)
cfn=(1)
calls=1 0 0
7 35
cfl=(1)
cfn=(2)
calls=1 0 0
11 5
cfl=(1)
cfn=(2)
calls=1 0 0
16 1
cfl=(1)
cfn=(3)
calls=1 0 0
22 7
cfl=(7)
cfn=(17)
calls=1 0 0
24 4606
cfl=(1)
cfn=(18)
calls=1 0 0
27 128
cfl=(11)
cfn=(42)
calls=1 0 0
29 5312
cfl=(12)
cfn=(43)
calls=1 0 0
29 151
cfl=(9)
cfn=(68)
calls=1 0 0
32 1930
看了一下代码,发现用的是间隔截图发送服务器,再由服务器返回到其他页面,那么请问如果要有声音呢?
看了你的代码,用canvas获取图片上传,那么音频怎么采样呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.