Documentation
¶
Overview ¶
Package hbbtv provides HbbTV (Hybrid Broadcast Broadband TV) detection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Match ¶
type Match struct {
Version string `json:"version"`
}
Match represents the result of a successful HbbTV detection. It mirrors the PHP behavior of returning a version string from isHbbTv().
type Option ¶
type Option func(*Parser)
Option is a functional option for configuring Parser behavior.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses a single user agent for HbbTV information. Created via ParserFactory.NewParser() - do not instantiate directly.
func (*Parser) IsHbbTv ¶
IsHbbTv returns the parsed HbbTV version if detected, otherwise "". Mirrors PHP: DeviceDetector\Parser\Device\HbbTv::isHbbTv(): ?string
func (*Parser) Parse ¶
Parse mirrors the PHP parser's parse() semantics at a high level: - only parse user agents containing HbbTV/SmartTvA - otherwise return nil
Note: For now this focuses on the behavior needed by the PHP unit test (isHbbTv). TV brand/model parsing from televisions.yml can be added on top.
type ParserFactory ¶
type ParserFactory struct {
// contains filtered or unexported fields
}
ParserFactory holds pre-compiled matchers and creates Parser instances. Thread-safe for concurrent use - create once, use from multiple goroutines.
func NewParserFactory ¶
func NewParserFactory(opts ...common.FactoryOption) (*ParserFactory, error)
NewParserFactory creates a factory with all regexes compiled once.
func (*ParserFactory) IsHbbTv ¶
func (f *ParserFactory) IsHbbTv(ua string) string
IsHbbTv is a convenience method mirroring PHP's $parser->isHbbTv(). It returns the HbbTV version string if detected, otherwise "".