Просмотр

Трансляция с камеры

Пришла мне однажды идея создать трансляцию с камеры, и я решил ее реализовать. Для создания этого дела нам понадобится 4 файла (5, если считать CSS).
1. Index.php. Где будет сама трансляция.
2. Save.php. Куда будет сохраняться изображение.
3. Now.php. Где будет храниться изображения в base:64.
4. Translate.php. Откуда будет вестись трансляция.

Принцип прост: на странице translate.php пользователь открывает доступ к камере, потом делается снимок каждую секунду, потом этот снимок отправляется на страницу index.php.

Приступим. Index.php. Тут ничего сложного нет.

        
Трансляция с вебкамеры
//берется изображение и выводится

save.php. Предельно прост:

now.php. Тоже ничего сложного:

 file_get_contents("./now.png")], JSON_UNESCAPED_UNICODE)); ?> 

translate.php. Вот тут и начинаются танцы с бубном:

        

Веб-камера

Кадр на сайте

На этом серверная часть готова. Можно теперь добавить чуть-чуть CSS.

 body < background-color: beige; font-family: ubuntu; >/* Шрифт измените на свой, если он у вас есть */ @font-face < font-family: Ubuntu; src: url("../Ubuntu.ttf") format("opentype"); >#title < text-align: center; font-size: 30px; >#viewer < text-align: center; margin-top: 3%; >#viewer img

Ну, вроде бы все. Теперь вы можете делать трансляцию с веб-камеры на сайт.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

HTML5 Videochat / Live Streaming 📹 📡 : Broadcast live video, Share link with others to watch, HTML5 WebRTC live video, Text chat with audio recordings / emoticons / mentions, Dark mode, Sound effects. 💯 100% Web Based, 🚫 No Flash.

videowhisper/HTML5-Videochat-PHP

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

PHP-HTML5-Videochat / Live Streaming — Standalone PHP

Live Demos for PHP Live Streaming / HTML5 Videochat : Broadcast & Playback Live Video

PHP Live Streaming Webcam

Before installing, test the simple setup in the live demos above.

This edition showcases streaming from 1 broadcaster to multiple viewers and chat. This plain php edition includes code and minimal scripts to embed a HTML5 Videochat app and test/showcase some features. This edition is for integrating/using application with own scripts/framework. For a complete implementation of advanced capabilities, see Turnkey HTML5 Videochat Site edition, available as WordPress plugin with full php source. The turnkey site edition implements pay per minute videochat (group and private 2 way video calls) with membership, billing, advanced tools.

Simple PHP Edition Features: Live Streaming: Broadcast & Playback

  • Automatically create a room as broadcaster on access and show link to invite participants that will access as viewers
  • Embed app to broadcast and playback live video using HTML5 WebRTC
  • Simple implementation of signaling broadcast (to connect automatically) and text chat, using plain files

Key Features for HTML5 Videochat / Live Streaming: Broadcast & Playback

  • WebRTC 1 way to many live video streaming, in public lobby
  • WebRTC relayed streaming (reliable and scalable to many clients from Wowza SE streaming server, independent of broadcaster upload connection) / P2P using VideoWhisper WebRTC
  • select camera, microphone, resolution, bitrate
  • screen sharing toggle, with microphone track mixed
  • video/audio recorder, emoticons, mentions in text chat
  • fullscreen for videochat interface or playback video
  • adaptive target video bitrate (depending on cam resolution) and configuration in resolution change
  • broadcasting/playback stats (open controls and stats should show in few seconds)
  • dark mode / lights on: each user can toggle interface mode live at runtime, SFX (sound effects)
  • translation and text change support
  • request private 2 way calls / shows from group chat
  • random videochat with Next button to move to different performer room
  • live wallet balance display (updates from tips and other transfers)
  • tips with multiple customizable options, gift images

Warning: some of these features are not active/implemented in this simplified edition, but can be enabled as in turnkey site edition.

Before installing, make sure your hosting environment meets all requirements including the Wowza SE as HTML5 WebRTC streaming relay and/or the VideoWhisper WebRTC signaling server. Production implementations should also involve Session Control for security and website integration (like list of live channels). For testing, get a free plan from WebRTC Host: P2P.

  1. If you don’t use a turnkey webrtc relay streaming host, configure WebRTC + SSL with Wowza SE or the VideoWhisper WebRTC + STUN/TURN server.
  2. Deploy files to your web installation location. (Example: yoursite.domain/html5-videochat/)
  3. Fill your streaming settings in settings.php file
  4. If you don’t have SuPHP, enable write permissions (0777) for folder «uploads», required to save session and chat info.

Plain PHP Edition Limitations

  • The plain php edition refers to minimal scripts for configuring and accessing videochat room, so developers can integrate with own scripts.
  • Plain php edition does not involve database and systems to manage members, rooms, billing. These depend on framework you want to integrate, plugins, database, member system.
  • Applications reads parameters, wallet balance and other data with ajax calls from framework/integration scripts (that need to be implemented depending on framework, database, user scripts).
  • A complete implementation of features is available for WordPress framework. See Turnkey HTML5 Videochat Site edition, available as WordPress plugin with full php source. Includes user role management (performers/clients), pay per minute, integrates billing wallets.
  • Plain edition implements 1 way streaming and chat with broadcast / playback screens for broadcaster and other participants. Application supports but this edition does not implement signaling for requesting 2 way video calls or parameters and content for conference/collaborations.
  • index.php embeds the html5 application: accessed directly creates a room and shows room link to invite others
  • app-call.php is called by application to retrieve parameters, interact with web server, update status and chat (ajax calls)
  • app-functions.php functions implementing features for app-call.php , including translated texts, app settings
  • settings.php settings and options, including streaming settings and url for calls (when integrating with own framework)

Scripts also contain comments for clarifications/suggestions.

This is a simple setup showcasing easy app deployment and integration with other PHP scripts. For a quick setup, see VideoWhisper Turnkey Stream Hosting Plans that include requirements for all features and free installation.

VideoWhisper HTML5 Project Demos

VideoWhisper HTML5 Project Downloads

For a free consultation Consult VideoWhisper or Submit Ticket related to commercial services like turnkey platforms, compatible hosting, custom development services.

About

HTML5 Videochat / Live Streaming 📹 📡 : Broadcast live video, Share link with others to watch, HTML5 WebRTC live video, Text chat with audio recordings / emoticons / mentions, Dark mode, Sound effects. 💯 100% Web Based, 🚫 No Flash.

Источник

Читайте также:  String concatenation in cpp
Оцените статью