VAST XML Data
Purpose
This subtopic addresses the need to supply standardized VAST (Video Ad Serving Template) XML ad data for VPAID-compliant video advertisements played within a WebView. While the parent topic focuses on integrating VPAID ads inside a WebView and managing their lifecycle and communication, this subtopic specifically encapsulates how the raw VAST XML ad data is provided and made accessible to the VPAID playback component. Supplying a consistent and complete VAST XML enables the WebView-based VPAID client to parse, load, and initiate video ads as per industry standards.
Functionality
The core responsibility here is to provide a static or dynamically parsed VAST XML string that represents the ad metadata, tracking URLs, media files, and parameters needed for ad playback. This XML data conforms to the VAST 3.0 specification and includes detailed ad information such as:
Ad system and title
Impression and tracking URLs for events (start, complete, firstQuartile, midpoint, etc.)
Creative media files including JavaScript VPAID media files with delivery and bitrate attributes
Ad parameters encoded as JSON within CDATA sections
Extensions and pricing information
This subtopic offers a single point of access to the VAST XML string through a static method, which can be called by the VPAID WebView client or related components to retrieve the ad data for injection into the WebView or for further processing.
Key Method Interaction
getAdXmlBody()returns the complete VAST XML string.public static String getAdXmlBody() { if (TextUtils.isEmpty(adXmlBody)) { return ""; } return "<VAST xmlns:xsi=...> ... </VAST>"; }
The method currently returns a hardcoded XML string representing a sample VAST ad. This structure could be extended to decode a Base64-encoded XML string or fetch the XML from a network source, but its main role remains providing the VAST XML payload.
Relationship
This subtopic integrates tightly with the **VPAID Ad Integration** parent topic by serving as the ad data source for the WebView-based VPAID client (`TubiVPAID`). When the VPAID player initializes or requests the ad, it calls into this subtopic to obtain the VAST XML string, which is then loaded into the WebView to start the ad playback lifecycle.
This separation allows the VPAID playback logic to remain agnostic of the ad data origin, improving modularity. Other subtopics in the parent topic handle the ad playback UI, JavaScript interface callbacks, and FSM state transitions based on the VAST XML data provided here.
Diagram
flowchart TD
A[VPAID WebView Client] -->|requests| B[getAdXmlBody()]
B --> C[VAST XML String]
C --> D[Load XML in WebView]
D --> E[Start VPAID Ad Playback]
This flowchart illustrates how the VPAID WebView client requests the ad XML from this subtopic, receives the VAST XML string, loads it into the WebView, and triggers the ad playback process.