{"id":21629763,"url":"https://github.com/harryr/camaste","last_synced_at":"2025-04-11T13:51:27.520Z","repository":{"id":16674701,"uuid":"19430532","full_name":"HarryR/camaste","owner":"HarryR","description":"Webcam Streaming Platform","archived":false,"fork":false,"pushed_at":"2014-05-11T04:30:41.000Z","size":344,"stargazers_count":9,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T10:04:47.601Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HarryR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-04T16:28:30.000Z","updated_at":"2024-04-01T07:22:56.000Z","dependencies_parsed_at":"2022-09-15T21:12:05.410Z","dependency_job_id":null,"html_url":"https://github.com/HarryR/camaste","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryR%2Fcamaste","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryR%2Fcamaste/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryR%2Fcamaste/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryR%2Fcamaste/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarryR","download_url":"https://codeload.github.com/HarryR/camaste/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248411952,"owners_count":21099032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T02:08:41.063Z","updated_at":"2025-04-11T13:51:27.495Z","avatar_url":"https://github.com/HarryR.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Layout\n\n * `components/publisher` - Haxe/Flash based webcam streaming SWF\n * `components/frontend` - Django based frontend\n * `components/realtime` - Tornado / Redis based realtime stuff\n * `components/nginx` - Nginx with rtmp module + config for testing + proxy for frontend \u0026 realtime\n * `components/redis` - Redis server\n * `vagrant` - Vagrant box for running the app in\n * `deploy` - Directory where publicly accessible data goes (for collectstatic \u0026 uploads)\n\n# TODO:\n\n * More implementation of site frontend\n * Implement more models in Django project\n * Configurable options in 'publisher' component so model can choose different broadcast settings in frontend\n * Figure out what sorts of billing will be done\n * Fill out the spec with more technical details\n * Decide on realtime service which supports sock.js\n * More info on this document?\n\n# Architecture\n\n * Web Frontend\n * RTMP Server\n * Backend Hooks/Control Service (internal)\n * Web Chat/Realtime Service\n\nTechnology:\n * nginx + nginx-rtmp-module\n * Django 1.6\n * MySQL 5.x for most data\n * Redis (for live/realtime data + fast backend stuff)\n\n## Web Frontend\n\n Django based application provides the frontend \u0026 admin interface for the site.\n Functionality:\n\nAll users:\n  * Browse active models + view model profiles (CORE)\n  * Browse live streams (CORE)\n  * Signup / Login / Activate Account / Reset Password (CORE)\n  * Purchase credits\n\nModels only:\n  * Signup as Model (CORE)\n  * Edit model profile + 'approval status' + manage model stuff (CORE)\n  * Broadcast as model (CORE)\n\nAdmin:\n  * Manage site finances\n  * Manage promotions and other shit\n  * Approve/disapprove new models\n\n\n## Web Chat/Realtime Service\n\nThe realtime service provides support for real-time notification of web clients from the backend and the webapp.\n\nThe main uses for this service will be:\n * Realtime model chat\n * Realtime notifications of show/model status\n * Update of credits status/usage\n\nIt must be fast and scalable, it shouldn't depend on Django or MySQL and shouldn't have to handle much (if any) business logic - just delivering notifications from the backend to a specific client (for notifications) or a channel of clients (for chat).\n\nPossible softwares:\n * http://simplapi.wordpress.com/2013/09/22/sockjs-on-steroids/ ?\n * Probably going to be python + gevent based, unless other *fast* service can be found\n\n## RTMP Service\n\nThe RTMP service is going to be powered by nginx-rtmp-module, this module has the following critical features:\n\n * HTTP Live streaming support (for iPad/iOS support and HTML5 only video)\n * HTTP based control and stats interface\n * Automatic saving of stream keyframes\n * Hooks on all types of RTMP events (e.g. publish, play)\n * Can do server-side redirection of streams\n\nUsing the hooks and the control interface we can implement all of the backend functionality required for cam site.\n\nDocumentation:\n\n * Homepage: https://github.com/arut/nginx-rtmp-module/\n * Blog: http://nginx-rtmp.blogspot.fr/\n * Configuration Docs: https://github.com/arut/nginx-rtmp-module/wiki/Directives\n\n### Implementing + Hooks + Billing\n\nThe publishers will connect to an endpoint like rtmp://$ip/publish/$token, we can provide this URL to the publishers to use with their own streaming software or they can use flash based broadcaster on our site. When a publisher connects the rtmp module calls our `on_publish` hook where we authenticate the token + ensure the publisher can only publish 1 stream at a time.\n\nWhen clients connect we can do authentication too via the `on_play` hook. The `on_update` hook is called every 30 seconds (configurable via `notify_update_timeout`) for *every* active connection (both publisher and client). We can use this callback to implement per minute billing, or time limit cut-off etc.\n\nThe `on_publish_done` callback can be used to update the site and disable the `is_broadcasting` flag on the model.\n\n### Example Config\n\n```\nrtmp {\n\tserver {\n\t\tlisten 1935;\n\t\tping 30s;\n\t\tnotify_method get;\n\n\t\tapplication src {\n\t\t\tlive on;\n\t\t\tallow publish all;\n\t\t\tallow play all;\n\n\t\t\ton_play http://localhost/backend/on_play;\n\t\t\ton_publish http://localhost/backend/on_publish;\n\t\t\ton_play_done http://localhost/backend/on_play_done;\n\t\t\ton_publish_done http://localhost/backend/on_publish_done;\n\t\t\ton_record_done http://localhost/backend/on_record_done;\n\t\t\ton_update http://localhost/backend/on_update;\n\t\t\tnotify_update_timeout 30s;\n\n\t\t\tmeta copy;\n\t\t\tsync 100ms;s\n\t\t\tinterleave on;\n\t\t \twait_key on;\n    \t\twait_video on;\n    \t\tdrop_idle_publisher 30s;\n\t\t\tidle_streams on;\n\t\t}\n\n\t\tapplication hls {\n\t\t\tlive on;\n\t\t\thls on;\n\t\t\thls_path tmp/hls;\n\t\t\thls_fragment 15s;\n\t\t}\n\t}\n}\n```\n\n\n## Backend Hooks / Control Service\n\nIdeally the backend billing stuff should be separated from the frontend and must be able to run independently.\nIt should probably use Redis for storage.\nIt probably shouldn't use Django because it needs to be *fast*, lightweight and possibly asynchronous?\n\nFunctionality:\n \n * All the hooks required for the RTMP server\n * Core authentication of publishers \u0026 clients\n * Billing\n * Time limiting of sessions\n\n\nTODO?\n * Performer, should rename to ModelProfile?\n * Need to keep all monetary balances SEPERATE from the Performer/Account models\n\nRealtime chat:\n * http://simplapi.wordpress.com/2013/09/22/sockjs-on-steroids/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryr%2Fcamaste","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryr%2Fcamaste","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryr%2Fcamaste/lists"}