### Run Example Server
Source: https://github.com/wwbn/avideo/blob/master/vendor/google/apiclient/README.md
Start the PHP built-in web server to view examples in your browser. Ensure you are in the directory containing the examples.
```bash
$ php -S localhost:8000 -t examples/
```
--------------------------------
### Example Output: Start Socket Server
Source: https://github.com/wwbn/avideo/wiki/Socket-Plugin
This example shows the typical output when starting the socket server, including debug information, port details, and SSL certificate parameters.
```text
root@youphptube2:~# php /var/www/html/demo.avideo.com/plugin/YPTSocket/server.php
[2022-01-26 12:17:39] AVideoLog::DEBUG: getStart language: got from config SCRIPT_NAME: /var/www/html/demo.avideo.com/plugin/YPTSocket/server.php
[2022-01-26 17:17:39] AVideoLog::DEBUG: Starting Socket server at port 2053 SCRIPT_NAME: /var/www/html/demo.avideo.com/plugin/YPTSocket/server.php
Starting AVideo Socket server version 2.8 on port 2053
Your socket server uses a secure connection
Parameter [local_cert]: /etc/letsencrypt/live/demo.avideo.com/fullchain.pem
Parameter [local_pk]: /etc/letsencrypt/live/demo.avideo.com/privkey.pem
Parameter [allow_self_signed]: 1
Parameter [verify_peer]:
Parameter [verify_peer_name]:
Parameter [security_level]: 0
2022-01-26 17:17:39 Construct
```
--------------------------------
### Setup and Run Tests
Source: https://github.com/wwbn/avideo/blob/master/node_modules/promise-polyfill/README.md
Install project dependencies and run the test suite for the promise-polyfill.
```bash
npm install
npm test
```
--------------------------------
### Install Dependencies and Run Dev Server
Source: https://github.com/wwbn/avideo/blob/master/node_modules/hls.js/README.md
Clone the repository, install dependencies, and start the development server for testing and development.
```bash
git clone https://github.com/video-dev/hls.js.git
cd hls.js
# After cloning or pulling from the repository, make sure all dependencies are up-to-date
npm install ci
# Run dev-server for demo page (recompiles on file-watch, but doesn't write to actual dist fs artifacts)
npm run dev
# After making changes run the sanity-check task to verify all checks before committing changes
npm run sanity-check
```
--------------------------------
### Development Installation and Watch Command
Source: https://github.com/wwbn/avideo/blob/master/node_modules/glightbox/README.md
Commands to install project dependencies and start a development server that watches for file changes.
```bash
$ npm install
$ npm run watch
```
--------------------------------
### Async HTTP Server Example
Source: https://github.com/wwbn/avideo/blob/master/vendor/react/event-loop/README.md
A quickstart example demonstrating an asynchronous HTTP server built using the event loop. It handles incoming connections, sends a response, and includes a periodic timer to report memory usage.
```php
```
--------------------------------
### Start WebSocket Server
Source: https://github.com/wwbn/avideo/wiki/Socket-Plugin
Starts the WebSocket server. This command is used after stopping the server or during initial setup.
```bash
sudo php /var/www/html/AVideo/plugin/YPTSocket/server.php
```
--------------------------------
### Installation
Source: https://github.com/wwbn/avideo/blob/master/node_modules/@videojs/xhr/README.md
Install the @videojs/xhr package using npm.
```bash
npm install @videojs/xhr
```
--------------------------------
### Install queue-microtask
Source: https://github.com/wwbn/avideo/blob/master/node_modules/queue-microtask/README.md
Install the package using npm.
```bash
npm install queue-microtask
```
--------------------------------
### Install Video.js via CDN (Fastly)
Source: https://github.com/wwbn/avideo/blob/master/node_modules/video.js/README.md
Include Video.js using the Fastly CDN by adding these tags to your document's head. This is a quick way to get started.
```html
```
--------------------------------
### Build Intro.js
Source: https://github.com/wwbn/avideo/blob/master/node_modules/intro.js/README.md
Install dependencies and run the build script to minify static resources for Intro.js.
```bash
npm install
npm run build
```
--------------------------------
### Serve Swagger UI Assets with Express
Source: https://github.com/wwbn/avideo/blob/master/plugin/API/docs/usage/installation.md
Use the 'swagger-ui-dist' package with Express to serve Swagger UI assets. This example demonstrates how to get the absolute path to the installed module.
```javascript
const express = require('express')
const pathToSwaggerUi = require('swagger-ui-dist').absolutePath()
const app = express()
app.use(express.static(pathToSwaggerUi))
app.listen(3000)
```
--------------------------------
### Hybridauth Twitter Provider Example
Source: https://github.com/wwbn/avideo/blob/master/vendor/hybridauth/hybridauth/README.md
This snippet demonstrates how to authenticate with Twitter using Hybridauth, retrieve an access token, get the user profile, and make an API request. Ensure PHP 5.4+ and cURL are installed.
```php
$config = [
'callback' => 'https://example.com/path/to/script.php',
'keys' => [
'key' => 'your-twitter-consumer-key',
'secret' => 'your-twitter-consumer-secret',
],
];
try {
$twitter = new Hybridauth\Provider\Twitter($config);
$twitter->authenticate();
$accessToken = $twitter->getAccessToken();
$userProfile = $twitter->getUserProfile();
$apiResponse = $twitter->apiRequest('statuses/home_timeline.json');
}
catch (\Exception $e) {
echo 'Oops, we ran into an issue! ' . $e->getMessage();
}
```
--------------------------------
### Serve Documentation Locally
Source: https://github.com/wwbn/avideo/blob/master/node_modules/bootstrap/README.md
Starts a local server to view the Bootstrap documentation in a browser.
```bash
npm run docs-serve
```
--------------------------------
### Basic three.js Scene Setup and Animation
Source: https://github.com/wwbn/avideo/blob/master/node_modules/three/README.md
This snippet demonstrates how to initialize a three.js scene, camera, and renderer, add a cube, and set up an animation loop. It's useful for getting started with 3D graphics in the browser.
```javascript
import * as THREE from './js/three.module.js';
let camera, scene, renderer;
let geometry, material, mesh;
init();
function init() {
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
camera.position.z = 1;
scene = new THREE.Scene();
geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animation );
document.body.appendChild( renderer.domElement );
}
function animation( time ) {
mesh.rotation.x = time / 2000;
mesh.rotation.y = time / 1000;
renderer.render( scene, camera );
}
```
--------------------------------
### GET Request with Options Example
Source: https://github.com/wwbn/avideo/blob/master/node_modules/videojs-vr/node_modules/@videojs/xhr/README.md
Make a GET request with additional options.
```javascript
var req = xhr(url, options, callback)
```
--------------------------------
### Basic GET Request Example
Source: https://github.com/wwbn/avideo/blob/master/node_modules/videojs-vr/node_modules/@videojs/xhr/README.md
Make a simple GET request to a URL.
```javascript
var req = xhr(url, callback)
```
--------------------------------
### Install Intro.js with npm
Source: https://github.com/wwbn/avideo/blob/master/node_modules/intro.js/README.md
Use npm to install Intro.js as a dependency for your project.
```bash
npm install intro.js --save
```
--------------------------------
### Start Intro.js Tour
Source: https://github.com/wwbn/avideo/blob/master/node_modules/intro.js/README.md
Initialize and start the Intro.js tour with a simple JavaScript call.
```javascript
introJs().start();
```
--------------------------------
### Install immediate.js
Source: https://github.com/wwbn/avideo/blob/master/node_modules/immediate/README.md
Install the immediate.js library using npm.
```bash
npm install immediate --save
```
--------------------------------
### Install LevelUp and LevelDown
Source: https://github.com/wwbn/avideo/blob/master/node_modules/levelup/README.md
Install LevelUp and a compatible store like LevelDown to begin using LevelUp.
```sh
$ npm install levelup leveldown
```
--------------------------------
### ltgt.start
Source: https://github.com/wwbn/avideo/blob/master/node_modules/ltgt/README.md
Gets the starting point of the range, considering the direction specified by 'reverse'. If 'start' is not provided in the range, a default value is used.
```APIDOC
## ltgt.start(range, default)
### Description
The start of the range. This takes into account direction (reverse). If a `start` is not provided, `default` is used.
### Parameters
#### Path Parameters
- **range** (object) - Required - The range object.
- **default** (any) - Optional - The default value to use if 'start' is not specified in the range.
```
--------------------------------
### Fallback Get and Set with Cache
Source: https://github.com/wwbn/avideo/blob/master/vendor/react/cache/README.md
Expands on fallback get by caching the value after fetching it from the database if it was not initially in the cache. This example uses chained promises for asynchronous operations.
```php
$cache
->get('foo')
->then(function ($result) {
if ($result === null) {
return $this->getAndCacheFooFromDb();
}
return $result;
})
->then('var_dump');
public function getAndCacheFooFromDb()
{
return $this->db
->get('foo')
->then(array($this, 'cacheFooFromDb'));
}
public function cacheFooFromDb($foo)
{
$this->cache->set('foo', $foo);
return $foo;
}
```
--------------------------------
### Example of Chaining getMock() for Mock Setup
Source: https://github.com/wwbn/avideo/blob/master/vendor/mockery/mockery/docs/reference/expectations.md
Demonstrates how to use getMock() to keep mock setup as a single, fluent statement, improving readability for simple mock configurations.
```php
$mock = \Mockery::mock('foo')->shouldReceive('foo')->andReturn(1)->getMock();
```
--------------------------------
### Basic Video.js Player Setup with data-setup
Source: https://github.com/wwbn/avideo/blob/master/node_modules/video.js/README.md
Create a standard HTML5 video element with the 'video-js' class and a 'data-setup' attribute for automatic player initialization. The 'data-setup' attribute must contain valid JSON.
```html
```
--------------------------------
### SSL Certificate Paths Example
Source: https://github.com/wwbn/avideo/wiki/WebRTC-Server-(Deprecated)
Example paths for SSL certificates required for secure communication. Ensure these paths are correct for your server's Let's Encrypt setup.
```php
'CertPath'=>'/etc/letsencrypt/live/'.$ServerHost.'/cert.pem'
'KeyPath'=>'/etc/letsencrypt/live/'.$ServerHost.'/privkey.pem'
'ChainCertPath'=>'/etc/letsencrypt/live/'.$ServerHost.'/chain.pem'
```
--------------------------------
### Basic CodeMirror Setup with Standard Keymap
Source: https://github.com/wwbn/avideo/blob/master/node_modules/@codemirror/commands/README.md
Demonstrates how to set up a CodeMirror editor view and integrate the standard keymap along with a custom key binding for selecting a line.
```javascript
import {EditorView, keymap} from "@codemirror/view"
import {standardKeymap, selectLine} from "@codemirror/commands"
const view = new EditorView({
parent: document.body,
extensions: [
keymap.of([
...standardKeymap,
{key: "Alt-l", mac: "Ctrl-l", run: selectLine}
])
]
})
```
--------------------------------
### Start Development Server
Source: https://github.com/wwbn/avideo/blob/master/node_modules/m3u8-parser/CONTRIBUTING.md
Starts a local development server for running the application.
```bash
npm start
```
--------------------------------
### Install LAMP, FFmpeg, and Git on Ubuntu 16.x
Source: https://github.com/wwbn/avideo/wiki/How-to-install-LAMP,--FFMPEG-and-Git-on-a-fresh-Ubuntu-16.x---For-AVideo-Platform-version-3.x-or-older
Installs Apache, PHP 7 with necessary modules, MySQL, FFmpeg, Git, and libimage-exiftool-perl for handling portrait videos. This command is essential for setting up the AVideo Platform environment.
```bash
sudo apt-get install apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-gd php7.0-intl mysql-server mysql-client ffmpeg git libimage-exiftool-perl
```
--------------------------------
### Basic Usage with Composer
Source: https://github.com/wwbn/avideo/blob/master/vendor/nesbot/carbon/readme.md
A minimal example demonstrating how to include and use Carbon after installation with Composer.
```php