### Project Setup and Installation
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Clones the Playlet repository, navigates into the project directory, and installs project dependencies using npm.
```bash
git clone https://github.com/iBicha/playlet.git
cd playlet
npm install
```
--------------------------------
### Example SceneGraph Structure
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Demonstrates a basic SceneGraph structure with nodes like ApplicationInfo, Invidious, and PlayletWebServer, illustrating the initial setup before dependency binding.
```xml
```
--------------------------------
### Invidious Login URL Example
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Provides an example of a login URL for the Invidious service, demonstrating how a dynamic URL might be constructed using server information.
```bash
http://192.168.1.2:8888/invidious/login
```
--------------------------------
### @oninit Annotation Example (BrighterScript)
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Illustrates the usage of the '@oninit' annotation in BrighterScript to automatically call functions during the component's initialization.
```brighterscript
function Init()
end function
@oninit
function SomeFunction()
end function
```
--------------------------------
### Node Path Translation Example
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Demonstrates how Playlet translates node paths, similar to Unix file system paths, to find nodes within the scene graph. It shows the use of '.', '..', and '/' for navigation.
```brighterscript
node = m.top.getScene() ' "/"
node = node.findNode("Node1") ' "Node1"
node = node.getParent() ' ".."
node = node.findNode("Node2") ' "Node2"
node = node ' "."
node = node.findNode("Node3") ' "Node3"
```
--------------------------------
### Component Inclusion Example (XML)
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Demonstrates how to use the 'includes' attribute in an XML component file to incorporate functionality from another component part.
```xml
```
```xml
```
```xml
```
--------------------------------
### Dependency Binding Example
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Shows how to use the 'bind:' annotation within XML to establish dependencies between SceneGraph nodes, allowing for simplified dependency injection.
```xml
```
--------------------------------
### BrightScript Web Server Routing Annotation
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This snippet illustrates how Playlet's web server plugin handles routing annotations in BrightScript. It shows an example of decorating a function with `@get("/")` to map a specific HTTP GET request to a handler function that redirects the response.
```brs
@get("/")
function GoHome(context as object) as boolean
response = context.response
response.Redirect("/index.html")
return true
end function
```
--------------------------------
### ObserveField Pattern Example
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Demonstrates the recommended pattern for using ObserveField to prevent typos in callback function names.
```brighterscript
node.ObserveField("someField", FuncName(OnSomeFieldChanged))
```
--------------------------------
### Web Server Plugin Implementation
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This TypeScript code snippet represents the implementation of the web server plugin. It details how routing annotations like `@get`, `@post`, `@all`, and path matching (e.g., `*`) are processed to automatically register handlers with HTTP routers that inherit from `Http.HttpRouter`.
```typescript
// Placeholder for the actual TypeScript implementation of the web server plugin.
// The actual code would parse annotations like @get("/api/something") and register handlers with routers.
```
--------------------------------
### Component Binding Generation
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Illustrates how the Playlet plugin generates binding information from XML component definitions. This includes field bindings and child property bindings, which are used for automatic scene graph setup.
```xml
```
```brighterscript
@oninit
function InitializeBindings()
m.top.bindings = {
fields: {
"appController": "../AppController"
},
childProps: {
"Node1": {
"field1": "../Node2"
},
"Node2": {
"field1": "../Node1"
}
}
}
end function
```
--------------------------------
### Beep Behavior Script (BrighterScript)
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
A BrighterScript example of a component behavior ('Beep') that includes a function triggered by a field's change.
```brighterscript
' Beep.bs
function OnBeepSet()
print("BEEP BEEP!")
end function
```
--------------------------------
### BrightScript Type Generation - IsBool and ValidBool
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This example shows the generated BrightScript functions for type checking (`IsBool`) and type validation with a default value (`ValidBool`). These functions are created automatically based on type definitions, reducing boilerplate code.
```brs
' Returns true if the given object is of type Bool, false otherwise
function IsBool(obj as dynamic) as boolean
return obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
end function
' Returns the given object if it is of type Bool, otherwise returns the default value `false`
function ValidBool(obj as dynamic) as boolean
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
return obj
else
return false
end if
end function
```
--------------------------------
### Picture-in-Picture Mode in Playlet
Source: https://github.com/ibicha/playlet/blob/main/README.md
Guide on activating and using the picture-in-picture (PiP) mode within the Playlet app on Roku. Users can shrink the video to browse other content and restore it to full screen.
```roku-brightscript
When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
You can browse or search for videos while you watch
To restore currently playing video to full screen, press the ✳️ (options) button
```
--------------------------------
### Run Playlet Tests
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Executes the test suite for both playlet-app and playlet-lib. This command builds the test application, deploys it, runs the tests, and parses the results.
```bash
npm run test
```
--------------------------------
### Playlet Component Library Download URL
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Playlet uses GitHub releases to host and deliver its component libraries. The default URL points to the latest squashfs package, but this can be configured to an alternative HTTPS endpoint.
```brightscript
"https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg"
```
--------------------------------
### Svelte Web App Development Workflow
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Recommended iteration process for developing the Playlet web application using Svelte, Vite, and TypeScript. This workflow aims to improve iteration speed by leveraging Vite's development server.
```bash
# Start Playlet (dev)
# Once Playlet starts, switch to Playlet Web (dev) and press play.
# Do not stop Playlet (dev)
```
--------------------------------
### Queueing a Job
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Demonstrates how to queue a job using the `JobSystem`. It creates a callback, queues a specific job (`Jobs.MyJob`) with input, and associates it with the callback for result handling.
```brighterscript
callback = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.MyJob, input, callback)
```
--------------------------------
### Playlet Development Library Host
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
During development, the Playlet library is packaged and served locally on port 8086 by a VS Code extension. The Playlet app then uses this local version instead of the one from GitHub.
```APIDOC
http://:8086/playlet-lib.zip
```
--------------------------------
### @oninit Transpiled Output (BrighterScript)
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Shows the transpiled BrighterScript code where the '@oninit' annotation results in the decorated function being called within the Init() function.
```brighterscript
function Init()
SomeFunction() ' auto-generated!
end function
function SomeFunction()
end function
```
--------------------------------
### Playlet Invidious API Configuration
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Configuration for fetching video data from Invidious is specified in a YAML file. This file defines the API endpoints and parameters used by Playlet to retrieve video information, enabling both the BrightScript app and the Web app to display consistent home page content.
```yaml
invidious_video_api:
base_url: "https://yewtu.be"
endpoints:
trending: "/api/v1/trending"
subscriptions: "/api/v1/subscriptions"
search: "/api/v1/search"
```
--------------------------------
### Lint and Format Playlet Code
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Commands to lint and format the Playlet codebase using bslint and brighterscript-formatter. These commands help maintain code quality and consistency.
```bash
npm run format
npm run format:fix
npm run lint
npm run lint:fix
```
--------------------------------
### Canary Release Process
Source: https://github.com/ibicha/playlet/blob/main/docs/RELEASING.md
This Makefile snippet illustrates the automated canary release process for Playlet, where a canary release is promoted to a stable version after QA.
```makefile
canary release + QA = stable version
```
--------------------------------
### Playlet Home Page Layout Configuration
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
The layout of the Playlet home page, which displays video feeds like Subscription and Trending, is defined in a YAML file. This allows for customization of the displayed content, including feeds fetched from sources like Invidious.
```yaml
home:
layout:
- type: "feed"
title: "Trending Videos"
source: "invidious"
params:
endpoint: "/trending"
- type: "feed"
title: "Subscriptions"
source: "invidious"
params:
endpoint: "/subscriptions"
```
--------------------------------
### Roku Development Environment Configuration
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Configures the Roku development environment by setting the target IP address and developer password in a .env file.
```makefile
ROKU_DEV_TARGET=INSERT_IP_HERE
ROKU_DEVPASSWORD=INSERT_PASSWORD_HERE
```
--------------------------------
### Dynamically Created Node Binding
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Shows the pattern for dynamically creating nodes using `CreateObject` and then manually triggering the binding process for that node using `BindNode()`.
```brighterscript
' Create a component
myNode = CreateObject("roSGNode", "MyComponent")
' Add it to the right parent
myParentNode.appendChild(myNode)
' Trigger the binding manually
myNode@.BindNode()
```
--------------------------------
### Playlet API for User Preferences
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
The Playlet web server provides an API endpoint to access and manage user preferences. This allows for importing and exporting preferences, which are defined in a JSON5 file.
```APIDOC
GET /api/preferences
Description: Retrieves user preferences.
Returns: A JSON object containing user preferences.
POST /api/preferences
Description: Updates user preferences.
Request Body: A JSON object with preferences to update.
Returns: Success or error message.
```
--------------------------------
### CI/CD Actions on Merge to Main
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
When changes are merged into the main branch, a GitHub action is triggered. This action builds the Playlet project, performs static analysis using Roku's Static Channel Analysis tool, and then releases a new version tagged as 'canary'. The build artifacts and changelog are attached to this release. Any previous 'canary' release is removed before the new one is created.
```yaml
name: CI/CD Pipeline
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Roku Environment
# Add steps to set up Roku development environment if necessary
run: |
echo "Setting up Roku environment..."
- name: Build Playlet
run: |
echo "Building Playlet..."
# Add your build command here
- name: Run Static Analysis
run: |
echo "Running Static Channel Analysis..."
# Add command to run Roku's Static Channel Analysis tool
# Example: rodev.exe --static-channel-analysis path/to/channel
- name: Remove previous canary release
run: |
echo "Removing previous canary release..."
# Add command to remove the previous canary release if it exists
- name: Release new canary version
run: |
echo "Releasing new canary version..."
# Add command to create a new release tagged 'canary' with artifacts and changelog
# Example: gh release create --title "Canary Release" --notes-file CHANGELOG.md --prerelease --draft v1.0.0
```
--------------------------------
### Playlet User Preferences Configuration
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
User preferences for Playlet are defined in a JSON5 file located at `playlet-lib/src/config/preferences.json5`. This file specifies configurable options like autoplay and preferred quality, and is parsed at runtime to generate the settings UI.
```json
{
"autoplay": {
"type": "boolean",
"default": true,
"label": "Autoplay Videos"
},
"preferredQuality": {
"type": "string",
"default": "720p",
"options": ["1080p", "720p", "480p"],
"label": "Preferred Video Quality"
}
}
```
--------------------------------
### BrightScript Language Extension Features
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Highlights key features of the BrightScript Language Extension for VS Code, including sending commands, SceneGraph inspection, and Roku Registry access, which are integrated into Playlet's debug mode.
```brightscript
- Sending commands to the App
- Like getting the focused node, inspecting values, etc
- SceneGraph inspector
- Allows you to see the hiearchy of the scene, and even modify elements at runtime. Useful for quick tweaks or adjusting UI.
- Roku Registry
- Allows you to inspect the content of the [Registry](https://developer.roku.com/en-ca/docs/references/brightscript/components/roregistry.md)
```
--------------------------------
### QR Code Generation Improvements
Source: https://github.com/ibicha/playlet/blob/main/playlet-lib/src/source/QrCode/CREDITS.txt
This section details changes made to the QR code generation functionality, including the removal of Kanji support to reduce size and the adoption of BrighterScript for certain parts of the implementation. The refactoring to classes aims to improve thread-friendliness for generating QR codes in tasks without freezing the UI. A cache file system (cachefs) has been added to prevent redundant regeneration of QR code images.
```BrighterScript
// Example of BrighterScript usage for QR code generation
// (Conceptual - actual implementation details would be here)
class QRCodeGenerator {
constructor(data, options = {}) {
this.data = data;
this.options = options;
}
generate() {
// Logic to generate QR code using BrighterScript
// This might involve calling other BrighterScript functions or classes
console.log("Generating QR code for:", this.data);
// ... implementation ...
return "qr_code_image_data";
}
}
// Cache mechanism (conceptual)
const cache = new CacheFS();
function getQRCode(data) {
const cacheKey = `qrcode_${data}`;
if (cache.has(cacheKey)) {
return cache.get(cacheKey);
}
const generator = new QRCodeGenerator(data);
const imageData = generator.generate();
cache.set(cacheKey, imageData);
return imageData;
}
```
--------------------------------
### Bindings Plugin Source Reference
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
A reference to the source code file for the bindings plugin, located at /tools/bs-plugins/bindings-plugin.ts.
```typescript
/tools/bs-plugins/bindings-plugin.ts
```
--------------------------------
### Using AutoBind Component Part
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Illustrates how to include the 'AutoBind' component part in a SceneGraph component definition, which is necessary for the binding logic to function.
```xml
```
--------------------------------
### Customize Invidious Instance in Playlet
Source: https://github.com/ibicha/playlet/blob/main/README.md
Steps to configure a custom Invidious instance within the Playlet app settings. This allows users to choose their preferred backend server for YouTube content and test its functionality.
```roku-brightscript
1. Open settings in Playlet
1. Select Invidious -> Instance
1. Set a custom instance, or choose a public one hosted by volunteers (from [api.invidious.io](https://api.invidious.io/))
1. Optionally, Select `Test instance` to make sure it works
1. Hit save
> ℹ️ **Note**: If you are logged in when you change the instance, you will remain logged in to the old instance. In this case, Playlet will use the old instance to retrieve your subscriptions and your playlists, but will use the new instance for everything else. After switching to a new instance, you can log out and log in again to use your profile on the new instance.
```
--------------------------------
### Playlet Definition
Source: https://github.com/ibicha/playlet/blob/main/README.md
This snippet provides the definition of 'Playlet' as a noun, including its pronunciation and meaning, highlighting its core concept.
```none
playlet - noun
play•let /ˈplālət/
: a short play
```
--------------------------------
### API Endpoint Model
Source: https://github.com/ibicha/playlet/blob/main/docs/models.md
Defines the structure for an API endpoint, including its ID, URL, query and path parameters, caching configuration, pagination type, authentication status, and response handling.
```APIDOC
ApiEndpoint:
id: string
url: string
queryParams: object
pathParams: object
cacheSeconds: number
paginationType: string
authenticated: boolean
responseHandler: string
```
--------------------------------
### Playlet Web Server Debug Endpoints
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
The Playlet web server exposes several API endpoints for debugging purposes. These endpoints allow inspection of application files, temporary directories, and cache file systems.
```APIDOC
GET /debug/pkg
Description: Inspect files under the Playlet App directory.
GET /debug/libpkg
Description: Inspect files under the Playlet Lib directory.
GET /debug/tmp
Description: Inspect files in the temporary directory.
GET /debug/cachefs
Description: Inspect files in the cache file system.
```
--------------------------------
### CI/CD Actions on Pull Requests
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
On pull requests, a GitHub action automatically executes `lint:fix` and `format:fix` commands. These commands are intended to automatically correct linting issues and format the code, pushing any resulting changes back to the pull request branch to maintain code quality and consistency.
```shell
lint:fix
format:fix
```
--------------------------------
### Feed Source Model
Source: https://github.com/ibicha/playlet/blob/main/docs/models.md
Represents a source for feed content, specifying the API type, endpoint details, and runtime state information for pagination and continuation.
```APIDOC
FeedSource:
id: string
title: string
apiType: string ("Invidious")
endpoint: ApiEndpoint
pathParams: object
queryParams: object
state:
paginationtype: string (Runtime field)
page: number (Runtime field)
continuation: string (Runtime field)
queryParams.page: string (Runtime field)
queryParams.continuation: string (Runtime field)
```
--------------------------------
### Component Inclusion Transpiled Output (XML)
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Shows the resulting XML structure of a component after the 'includes' plugin has processed the 'includes' attribute, copying fields, scripts, and child nodes.
```xml
```
--------------------------------
### Type Generation Plugin Implementation
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This TypeScript code outlines the core logic for the type generation plugin. It describes how type definitions, including interfaces and default values, are used to programmatically generate type-checking and validation functions.
```typescript
// Placeholder for the actual TypeScript implementation of the type generation plugin.
// The actual code would involve iterating over type definitions and generating functions like IsBool, ValidBool, etc.
```
--------------------------------
### Row List Layout Model
Source: https://github.com/ibicha/playlet/blob/main/docs/models.md
Defines a layout structure for displaying a list of feeds.
```APIDOC
RowListLayout:
Feed[]
```
--------------------------------
### Json5/Yaml Support Plugin
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This plugin enables the inclusion of JSONC, JSON5, and YAML files as static assets within the app. It converts these formats to plain JSON, supporting comments and minification, making them parsable by Brightscript's ParseJson function.
```typescript
import { Plugin } from 'brighterscript';
export default class JsonYamlPlugin implements Plugin {
name = 'json-yaml-plugin';
// ... plugin implementation details ...
}
```
--------------------------------
### Bookmarks Model
Source: https://github.com/ibicha/playlet/blob/main/docs/models.md
Represents a collection of bookmark groups.
```APIDOC
Bookmarks:
BookmarkGroup[]
```
--------------------------------
### ExecuteJob Function Definition
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Defines an `ExecuteJob` function annotated with `@job` to be executed by the Playlet job system. It retrieves input, performs work, and returns success data. The job is automatically generated as a component inheriting from `BaseJob`.
```brighterscript
@job("MyJob")
function ExecuteJob() as void
' input is an associative array set when the job is queued.
input = JobGetInput()
value = DoWork(myVar)
JobSuccessData({result: value})
end function
```
--------------------------------
### Bookmark Group Model
Source: https://github.com/ibicha/playlet/blob/main/docs/models.md
Represents a group of bookmarks, containing a title and a list of feed sources.
```APIDOC
BookmarkGroup:
title: string
feedSources: FeedSource[]
```
--------------------------------
### Playlet Roku Remote Commands
Source: https://github.com/ibicha/playlet/blob/main/docs/README.md
Provides commands to interact with the Playlet Roku application for development and debugging purposes. These commands can clear custom library URLs or the entire registry.
```APIDOC
curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/693751?clearPlayletLibUrls=true"
- Description: Clears custom Playlet library URLs, reverting to the default (latest release from Github).
- Target: $ROKU_DEV_TARGET environment variable should be set to the Roku device's IP address.
curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/693751?clearRegistry=true"
- Description: Clears all data from the Playlet registry on the Roku device.
- Target: $ROKU_DEV_TARGET environment variable should be set to the Roku device's IP address.
```
--------------------------------
### Track Transpiled Files Plugin Logic
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Illustrates the functionality of the `track-transpiled-plugin.ts`. It checks for `.transpiled` versions of files and folders during the transpilation process and copies them back if found. This plugin is primarily used for test builds to verify transpilation output.
```typescript
// Source: /tools/bs-plugins/track-transpiled-plugin.ts
// This plugin tracks transpiled files by checking for .transpiled counterparts.
// If MyComponent.xml is transpiled, it looks for MyComponent.transpiled.xml.
// If found, the transpiled output is copied to MyComponent.transpiled.xml.
// It also handles folders: MyFolder.transpiled will receive transpiled files from MyFolder.
// The plugin only runs during test builds to minimize noise.
```
--------------------------------
### BrightScript Logging Function Generation
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This snippet demonstrates how the logger plugin in Playlet automatically generates and modifies BrightScript logging functions. It replaces predefined log calls with versions that include the argument count and caller information (file and line number), simplifying debugging and log management.
```brs
function LogError2(arg0, arg1) as void
logger = m.global.logger
if logger.logLevel < 0
return
end if
m.global.logger.logLine = "[ERROR]" + ToString(arg0) + " " + ToString(arg1)
end function
```
--------------------------------
### Protobuf Generator Source
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This section details the Protobuf generator plugin, which is responsible for creating BrighterScript encoding/decoding functions for Protobuf types. It parses .proto files to generate serialization and deserialization functions, focusing on features required for Playlet.
```typescript
// Source: /tools/bs-plugins/proto-gen-plugin.ts
// This file contains the implementation for the Protobuf generator plugin.
// It parses .proto files and generates BrighterScript code for Protobuf serialization and deserialization.
// Example of a generated function (conceptual):
function serializeMyProtobufMessage(message: any): ArrayBuffer {
// ... serialization logic ...
return new ArrayBuffer(0);
}
function deserializeMyProtobufMessage(buffer: ArrayBuffer): any {
// ... deserialization logic ...
return {};
}
```
--------------------------------
### ObserveField Pattern (Not Allowed)
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Illustrates the pattern that the validation plugin aims to disallow due to potential typos in the callback string.
```brighterscript
node.ObserveField("someField", "OnSomeFieldChanged")
```
--------------------------------
### Child Declaration Binding
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Shows how to use the 'bind:' attribute directly within child node declarations in SceneGraph. This method allows specifying dependencies for child nodes, and the plugin handles the transpilation.
```xml
```
--------------------------------
### Feed Content Node Model
Source: https://github.com/ibicha/playlet/blob/main/docs/models.md
Represents a node in the feed content, containing a title and a list of associated feed sources.
```APIDOC
FeedContentNode:
Title: string
feedSources: FeedSource[]
feedSourceIndex: number (Runtime field)
```
--------------------------------
### Cast from Phone to Playlet
Source: https://github.com/ibicha/playlet/blob/main/README.md
Instructions on how to cast content from a mobile phone to the Playlet app on Roku. This includes using the Playlet remote tab, scanning a QR code, connecting via the YouTube app, or using the 'Link with TV code' feature.
```roku-brightscript
1. Open "Remote" tab in Playlet
- Scan QR Code with Phone, and use the browser; OR
- Use the YouTube app to connect using the same Wi-Fi; OR
- Use the `Link with TV code` to connect
```
--------------------------------
### Manifest Editing Plugin
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Allows dynamic modification of the app manifest based on compiler flags. It can set compilation constants (e.g., DEBUG), change the app's mode (e.g., for testing), or configure debugging settings like the host IP address.
```typescript
import { Plugin, Compiler } from 'brighterscript';
export default class ManifestEditPlugin implements Plugin {
name = 'manifest-edit-plugin';
constructor(private compiler: Compiler) {}
// ... plugin implementation details for modifying manifest ...
}
```
--------------------------------
### Logger Plugin Functionality
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Describes the purpose of the logger plugin, which modifies code during transformation to include caller information (path or filename) in logs, configurable based on debug or release settings.
```typescript
// Source: /tools/bs-plugins/logger-plugin.ts
// The logger plugin transforms code to add caller path or filename to logs.
// This logging behavior is configurable based on debug/release builds.
```
--------------------------------
### Component Field Reference Binding
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Demonstrates binding a node reference to a component's field using the 'bind:' attribute in the interface declaration. This allows direct assignment of a dependent node to a field.
```xml
```
--------------------------------
### Custom Validation Rules
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Enables custom diagnostic error messages during compilation to enforce specific coding patterns. Rules are defined using regular expressions in the bsconfig.json file, specifying error codes, messages, and regex flags.
```json
{
"validation": [
{
"code": "NO_OBSERVE_STRING_CALLBACK",
"regex": "\\.observeField(scoped)?\\s*\\(\\s*\"\\w+\"\\s*,\\s*\"\\w+\"\\s*\\)",
"regexFlags": "ig",
"message": "observeField(\"field\", \"callback\") is not allowed. Use observeField(\"field\", FuncName(callback)) instead."
}
]
}
```
--------------------------------
### Locale Validation Plugin Implementation
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
This TypeScript code snippet describes the purpose and functionality of the locale validation plugin. It aims to prevent common issues with Roku's localization system, such as unintended translation of node IDs, by enforcing rules to keep translation files synchronized with the code.
```typescript
// Placeholder for the actual TypeScript implementation of the locale validation plugin.
// The actual code would enforce rules to ensure translation files match code implementation.
```
--------------------------------
### Invidious API Information
Source: https://github.com/ibicha/playlet/blob/main/PRIVACY.md
Information regarding the use of Invidious instances for content retrieval. Playlet requests data from Invidious servers, sending only necessary information for content viewing. While Invidious is privacy-focused, potential data points like IP address, video identifiers, and search keywords could theoretically be known. Users concerned about privacy can host their own Invidious instances.
```APIDOC
Invidious:
Purpose: Content retrieval
Data Sent: Bare minimum and necessary information for content viewing
Potential Data Points (Theoretical): IP address, video identifiers, search keywords
User Control: Option to host own Invidious instance for enhanced privacy
Public Instances: Available at https://api.invidious.io/
```
--------------------------------
### LeanBack (Lounge API) Functionality
Source: https://github.com/ibicha/playlet/blob/main/PRIVACY.md
Explanation of the LeanBack (Lounge API) feature, enabling casting from a phone. All related traffic is routed through YouTube servers. Playlet implements privacy measures like randomizing device IDs and using fresh sessions. Connection is initiated via DIAL or 'Link with TV code'. Users can avoid this feature by not connecting locally or using the 'Link with TV code' tab.
```APIDOC
LeanBack (Lounge API):
Purpose: Cast videos from a separate device ('cast from phone')
Traffic Routing: All video watching, queue, and player state traffic routed through YouTube servers.
Privacy Measures:
- Randomizing device ID
- Using a fresh session on each start
- Providing only necessary fields for feature function
Connection Triggers:
- DIAL (Discovery And Launch spec) / 'Connect with Wi-Fi'
- Generating a 'Link with TV code'
User Control: Avoid by not connecting locally via YouTube app/browser or using the 'Link with TV code' tab.
```
--------------------------------
### SponsorBlock API Information
Source: https://github.com/ibicha/playlet/blob/main/PRIVACY.md
Information about Playlet's interaction with SponsorBlock servers to obtain sponsor sections for videos. Playlet uses hashing for video metadata requests to protect user privacy. An anonymous 'skipped' event may be sent to indicate feature usage without any tracking information.
```APIDOC
SponsorBlock:
Purpose: Retrieve sponsor sections for videos
Data Sent: Bare minimum and necessary information for content viewing
Privacy Features: Uses hashing for video metadata requests to obfuscate video IDs.
Events Sent: May send anonymous 'skipped' event to indicate section skipping without tracking information.
```
--------------------------------
### Ignoring Validation Errors
Source: https://github.com/ibicha/playlet/blob/main/docs/plugins.md
Provides a mechanism to ignore specific validation errors for a given line of code using a special comment.
```brighterscript
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
node.ObserveField("someField", "OnSomeFieldChanged")
```
--------------------------------
### Innertube API Information
Source: https://github.com/ibicha/playlet/blob/main/PRIVACY.md
Details on Playlet's direct requests to Innertube when the built-in backend is used. Similar to Invidious, only essential data is sent for content viewing. Associating a YouTube account with Innertube traffic can reduce privacy due to the need for features like subscriptions and watch history.
```APIDOC
Innertube:
Purpose: Direct content retrieval (when built-in backend is used)
Data Sent: Bare minimum and necessary information for content viewing
Account Association: Can associate Innertube traffic with YouTube account for features like subscriptions, playlists, and watch history, potentially reducing privacy.
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.