Univeresal Embed Player v2.3
Pre-release
Pre-release
·
2 commits
to main
since this release
Key Features
-
Dynamic Video Embedding:
- Link Detection: The script listens for click events on the page. When you click on a link (or an element containing a link), it inspects the URL in the
href, any visible text that looks like a URL, or even parameters within the URL (likeurl,target, etc.). - Domain Verification: By default, it checks whether the URL’s domain is allowed before embedding. It does this by comparing against a list of approved domains.
- Force Embedding Mode: There is an option to bypass the domain check. When this mode is enabled, the script will attempt to embed the video regardless of its domain.
- Link Detection: The script listens for click events on the page. When you click on a link (or an element containing a link), it inspects the URL in the
-
Configurable Allowed Domains:
- Remote Configuration: It fetches a JSON configuration file from GitHub that lists allowed domains. If fetching or parsing fails, it falls back to a default list (e.g.,
terabox.com,example.com). - Local Override: You can toggle Force Embedding Mode which ignores the allowed domain restrictions.
- Remote Configuration: It fetches a JSON configuration file from GitHub that lists allowed domains. If fetching or parsing fails, it falls back to a default list (e.g.,
-
Embedding Mechanism:
- Embed Code Generation: When a valid video link is detected, the script creates an HTML snippet that includes a resizable container and an
<iframe>. This<iframe>points to a URL built by appending the encoded video URL to a base URL (https://terabox-watch.netlify.app/api2.html?url=), which likely processes or plays the video. - Responsive Sizing: It calculates the optimal player size (defaulting to a 700px width and a 16:9 aspect ratio) based on the size of the parent container.
- Embed Code Generation: When a valid video link is detected, the script creates an HTML snippet that includes a resizable container and an
-
Interactive Resizing and Overlay:
- Resizable Container: The embedded player is placed inside a container that can be resized by dragging. During resizing, an overlay is temporarily shown to block interactions, ensuring a smooth resizing experience.
-
User Interface for Settings:
- Settings Panel: A small, circular icon is added to the bottom-right corner of the page. This icon acts as a toggle for the Force Embedding Mode.
- Icon & Color Indication: The icon changes between two symbols (⚡ for enabled and 💀 for disabled) and its color changes (yellow for active, red for inactive) to indicate the current mode.
- Toggle Functionality: Clicking the icon toggles the Force Embedding Mode, stores the state in
localStorage, and shows a brief on-screen notification (toast) to inform you of the change.
- Settings Panel: A small, circular icon is added to the bottom-right corner of the page. This icon acts as a toggle for the Force Embedding Mode.
-
Notifications and Logging:
- Toast Messages: The script shows temporary on-screen messages (toasts) to notify you of events such as errors, successful embeddings, or changes in mode.
- Console Logging: It logs key actions and decisions (like domain checks and errors) to the browser console for debugging purposes.