AVideo Documentation

repository·master·Indexed 24 days ago

https://github.com/wwbn/avideo

An open-source video streaming platform for hosting, managing, and monetizing video content. The platform consists of three main components: the Streamer (user interface), Encoder (video conversion), and Live Server (broadcasting). Key features include encrypted HLS streaming, live broadcasting with chat, restreaming, and monetization via subscriptions, Pay-Per-View, and VAST/VMAP ads. Requires PHP 8.0+, MySQL 5.0+, and Apache 2.x on Ubuntu without control panels.

Tokens
28.4K
Snippets
57
Records
140
Agent score
85%

What's inside AVideo

  1. Overview of AVideo Key Features

    master

    AVideo is a video streaming platform providing the following core capabilities:

    • Security: Encrypted HLS streaming for on-demand and live content.
    • Livestreaming: Secure live broadcasting with recording capabilities and integrated chat.
    • Restreaming: Rebroadcasting live content to multiple platforms simultaneously.
    • User Engagement: Custom user-generated channels and playlists.
    • Monetization: Support for Subscriptions, Pay-Per-View, and targeted video ad placements (including VAST and VMAP/Google Ads IMA).
    • Storage: Scalable cloud storage integration (S3, B2, FTP, etc.).
    • Extensibility: A dedicated API for third-party integrations.
    • Offline Access: Secure offline video downloading with content protection.
  2. Customize Swagger UI behavior via Plug points

    master

    Swagger UI exposes its internal logic through a plugin system, allowing you to override core internals to achieve custom behavior.

    Warning: Semantic Versioning Swagger UI's internal APIs are not part of the public contract and can change without a major version change. If your plugins consume internal core APIs, it is recommended to pin your dependency to a specific minor version (e.g., using ~3.11.0 in NPM) to ensure stability across patch updates.

  3. Understand the Swagger UI System abstraction

    master

    The system is a central JavaScript object that serves as the runtime heart of the Swagger UI application. It acts as a registry and provider for the following core elements:

    • React components: The UI building blocks.
    • Redux logic: Bound actions, reducers, and Reselect state selectors.
    • Component Registry: A system-wide collection of all available components.
    • Built-in Helpers: Functions like getComponent, makeMappedContainer, and getStore.
    • Library References: Direct access to system.React and system.Im (Immutable.js).
    • User Helpers: Custom helper functions defined by the user.

    Developers interact with the system primarily through plugins that contribute to or consume these resources.

  4. How the Swagger-UI plugin system works

    master

    A plugin is a function that accepts a toolbox argument and returns an object. This object is merged into a global system object and subsequently bound to the application state.

    The toolbox argument

    The toolbox argument provides access to the entire plugin system at the time the plugin factory is called. It includes a reference to the Immutable library, so plugin authors do not need to bundle it themselves.

    The system and State Binding

    All plugins are merged into a single system object. This system is then bound to the state and flattened for easier access. For example, if a plugin defines a namespace spec, the bound system will provide specActions and specSelectors instead of requiring deep object traversal.

    To access this bound system in a component, use getSystem on the store. Container components typically receive a spread of these props automatically.

    class Bobby extends React.Component {
    
      handleClick(e) {
        this.props.someNamespaceActions.actionName() // fires an action
      }
    
      render() {
        // Accessing flattened props from the bound system
        let { someNamespaceSelectors, someNamespaceActions } = this.props
        let something = someNamespaceSelectors.something()
    
        return (
          <h1 onClick={this.handleClick.bind(this)}> Hello {something} </h1>
        )
      }
    }
  5. Access Razorpay API resources

    master

    Once the $api instance is created, you can access various Razorpay resources (such as Payments, Orders, or Customers) using the pattern $api->resource->method().

    For example, to fetch a specific payment by its ID, use $api->payment->fetch($paymentId).

    // $api->class->function() to access the API
    // Example
    $api->payment->fetch($paymentId);
  6. How layouts and getComponent work together

    master

    In Swagger UI, layouts act as the top-level orchestration layer. When a layout component is rendered, it receives a getComponent function via props.

    This getComponent(name, required) method is the primary way to access internal Swagger UI components from within a custom layout.

    • name: The string identifier of the component (e.g., "operations", "BaseLayout").
    • required: A boolean indicating if the component must be present.

    This pattern allows developers to compose the UI by picking and choosing which parts of the standard Swagger UI experience to include, exclude, or wrap.

  7. Understand forbidden HTTP header names in web browsers

    master

    When developing web applications, certain HTTP header names are restricted by web browsers for security reasons. These 'forbidden headers' cannot be manually set or controlled by your application's code via APIs like XMLHttpRequest or fetch.

    This limitation specifically impacts OpenAPI 3.0 Cookie parameters, which cannot be controlled when running Swagger UI in a browser environment.

  8. Use React without JSX via system.React

    master
    If your development environment does not have a build pipeline (like Babel) to translate JSX into JavaScript, you can avoid JSX by using the system.React reference provided by the Swagger UI system. This allows you to leverage React's API directly without needing to bundle a separate copy of React into your project.
  9. Ensure CORS headers support Swagger UI parameters

    master
    When using Swagger UI to send custom headers as parameters, those header names MUST be explicitly listed in your server's CORS configuration under the Access-Control-Allow-Headers directive. If a header is not included in this list, Swagger UI will be unable to send it.
  10. Format deep-link URL fragments

    master

    Deep links are triggered using URL fragments following these two formats:

    • #/{tagName}: Focuses on a specific tag.
    • #/{tagName}/{operationId}: Focuses on a specific operation within a tag.

    Note on operationId: Use the explicit operationId defined in your specification. If no operationId is provided, Swagger UI generates an implicit one by combining the operation's path and method (escaping non-alphanumeric characters).

  11. How Swagger UI plugins work

    master

    A plugin is a function that returns an object containing functions and components used to augment or modify Swagger UI's functionality. Each plugin is passed a reference to the system being built up.

    Important Considerations:

    • Dependency Management: There is no built-in dependency management. If your plugin relies on another, you must ensure the dependent plugin is loaded after the required one.
    • Semantic Versioning: Internal APIs are not part of the public contract and may change without a major version bump. If your plugin wraps or extends internal core APIs, pin your dependency to a specific minor version (e.g., using ~ in NPM) to ensure stability across patch updates.
    {
      statePlugins: {
        [stateKey]: {
          actions,
          reducers,
          selectors,
          wrapActions,
          wrapSelectors
        }
      },
      components: {},
      wrapComponents: {},
      rootInjects: {},
      afterLoad: (system) => {},
      fn: {},
    }