Monday, July 22, 2013

PHP JQUERY FLASH LIVE STREMING BROADCAST

Source fromhttp://www.videowhisper.com

VideoWhisper > Live Streaming > PHP Stand Alone

Find on this page more info about PHP Live Streaming: 
online demo
installation instructions
integration and customization documentation

Enter Live Streaming Broadcast Demo
How to test:
1. Publish channel (you can specify a name or a StudioYYY name will be automatically generated)
2. Allow access to your webcam and select the camera/audio source if you have multiple on your system.
3. Click the "Channel Link" box (the link will be automatically copied)
4. Send link to your friends to watch or open a new browser window or tab and paste the url there to access the viewer interface for that channel or send
Installation Instructions for PHP Live Video Streaming Software
Before installing, make sure your hosting environment meets all requirements.
1. If you're not hosting RTMP with us go to RTMP Application Setup for installation details

2. Download archive, unzip and copy contents of ls_php to your web installation location. (Example: www.yoursite.com/live/)

3. Fill your RTMP path into settings.php

4. If you don't have SuPHP, enable write permissions (0777) for folders: snapshotsuploads


Customizing & Integrating Live Video Streaming on your site

  • To integrate this with other scripts read an integration overview for videowhisper applications first, to understand the framwework and where to start from.
  • Edit skins, incons, sounds in templates/live
  • This can be integrated with your members database and login system. Variables like username, loggedin (1 if user was logged in and allowed to enter, 0 otherwise), welcome message, visitor ( 1 if user is visitor and needs to provide a name in watch interface, 0 otherwise), timer settings are passed from these files:
    • vc_login.php : Video Broadcasting Interface (live_broadcast.swf)
    • vs_login.php : Video Watch and Discuss Interface (live_watch.swf)
    • vv_login.php : Live Video Interface (live_video.swf)
  • Broadcasting webcam settings (bandwidth, resolution, frames per second) and limitations (settings panel, advanced settings panel, maximum bandwidth) are also configured in vc_login.php
  • Broadcasting interface reports active broadcasters to lb_status.php. This also controls timer and can terminate session.
  • On logout broadcaster is redirected to lb_logout.php .
  • Included players report active watches to v_status.php which controls time and can terminate session. Edits this to implement ppv/ppm functionality for users watching video.
    • Change $maximumSessionTime=0 to limit maximum session time in milliseconds (set it to 600000 for 10 minutes)
    • You can also implement code to save a cookie (to check and prevent log back for a certain time) and disconnect by setting a custom disconnect message for user in $disconnect .
  • Channel page can be edited and flash resized as needed: channel.php
    Also there's a sample plain video page: video.php
  • Snapshots for all channels are saved in the snapshots folder as jpg. Size depends on webcam resolution.
  • There are multiple parameters to edit. In example in vc_login.php there are many configuration options for video broadcasting interface:
    • connection settings: server=<?=$rtmp_server?>&serverAMF=<?=$rtmp_amf?>&tokenKey=<?=$tokenKey?>
      &serverProxy=best : "none", "HTTP", "CONNECT", "best"To use native SSL, set the property to "best". If the player cannot make a direct connection to the server (over the default port of 443 or over another port that you specify) and a proxy server is in place, the player tries to use the CONNECT method. If that attempt fails, the player tunnels over HTTPS.
      If the property is set to "HTTP" and a direct connection fails, HTTP tunneling is used. If the property is set to "CONNECT" and a direct connection fails, the CONNECT method of tunneling is used. If that fails, the connection does not fall back to HTTP tunneling.
      This property is applicable only when using RTMP, RTMPS, or RTMPT. The CONNECT method is applicable only to users who are connected to the network by a proxy server. 
    • p2p settings: &serverRTMFP=<?=$rtmfp_server?>&p2pGroup=VideoWhisper
      &enableRTMP=1&enableP2P=0&supportRTMP=1&supportP2P=1&alwaysRTMP=0&alwaysP2P=0
      enable Default setting.
      support Allows broadcaster to use that streaming mode.
      always Always enabled (ie. alwaysRTMP to make sure all streams go to server for archiving/external publishing) .
    • H264 codec settings: &videoCodec=H264&codecProfile=main&codecLevel=3.1
      videoCodec: H264 / other value uses default codec
      codecProfile: baseline/main for H264
      codecLevel: 1, 1b, 1.1, 1.2, 1.3, 2, 2.1, 2.2, 3, 3.1, 3.2, 4, 4.1, 4.2, 5, 5.1 for H264
    • sound codec settings: &soundCodec=Speex&soundQuality=9&micRate
      soundCodec: Speex/Nellymoser
      micRate: 11/22/44 for Nellymoser
      soundQuality: 0-10 for Speex
    • logo overlay: &overLogo=logo.png&overLink=http://www.videowhisper.com
    • channel (room) details: &room=<?=$username?>&welcome=Welcome!
    • user login and type: &username=<?=$username?>&userType=3&webserver=&msg=&loggedin=1
    • user picture and profile link: &userPicture=<?=$userPicture?>&userLink=<?=$userLink?> - user snapshot and profile link
    • embed codes: linkcode=<?=urlencode($linkcode)?>&embedcode=<?=urlencode($embedcode)?>&embedvcode=<?=urlencode($embedvcode)?>&imagecode=<?=urlencode($imagecode)?>
    • room limitations: room_limit=&showTimer=1&showCredit=1&disconnectOnTimeout=1
    • streaming settings: &camWidth=320&camHeight=240&camFPS=15&camBandwidth=40960
    • buffering settings: &bufferLive=2&bufferFull=16
    • runtime editable settings: &showCamSettings=1&advancedCamSettings=1&camMaxBandwidth=81920&configureSource=1
    • snapshots: &generateSnapshots=1&snapshotsTime=15000 Enable sending jpg webcam snapshots to server.
    • layout and features: &onlyVideo=0&noEmbeds=0& Hide everything but video or just embed codes.
    • external text chat: &externalInterval=6000 Defines how often external chat messages are checked for (by calling vw_extchat.php), in milliseconds. Set 0 or any number lower than 500 to disable.
      Many of these parameters are also working with vv_login.php and vs_login.php for watch and video interfaces.
  • From vs_login.php, watch interface can be configured:
    • layout and features: &disableVideo=0&disableChat=0&disableUsers=0&layoutCode=<?=urlencode($layoutCode)?>&fillWindow=0
      //after getting it from text chat with /videowhisper layout fill your layout code between <<<layoutEND and layoutEND;
      $layoutCode=<<<layoutEND
      layoutEND; 
    • text chat filters: &filterRegex=<?=$filterRegex?>&filterReplace=<?=$filterReplace?>
      //replace bad words or expressions
      $filterRegex=urlencode("(?i)(badword1|badword2)(?-i)");
      $filterReplace=urlencode(" ** ");
    • text chat control: &writeText=1&floodProtection=3&privateTextchat=1
    • broadcaster offline message: &offlineMessage=Channel+Offline
    • status script calls: &statusInterval=10000 Define how often status script v_status.php is called
    • in chat ads: ws_ads=<?=urlencode("ads.php")?>&adsTimeout=15000&adsInterval=240000 Display ads right inside text chat
      Setup adsInterval in milliseconds (0 to disable ad calls), adsTimeout to setup time in milliseconds until first ad is shown. Also see AD in Chat compatible ad management server.
  • PHP edition also contains these additional views accesible from each standard channel page:
    video.php?n=Channel - only video stream player
    htmlchat.php?n=Channel - external text chat (to access from devices without video capability or integrate with other chat systems)