Class WebPageTextureProviderExperimental Wearable Only

WebPageTextureProvider is the associated texture control that can be accessed from the texture.control property. This allows you to call functions such as loadUrl(“https://snap.com”) or to pass input events to.

Note: Most functionality will require the onReady event to have been called. Any calls before this event may cause an exception.

// Create the options 
var resolution = new vec2(512, 512);
var options = RemoteServiceModule.createWebViewOptions(resolution);
const resolution = new vec2(512, 512)
const options = RemoteServiceModule.createWebViewOptions(resolution)

this.remoteServiceModule.createWebView(
options,
(texture: Asset.Texutre) => {
this.image.mainPass.baseTex = texture
this.webViewControl = texture.control
this.webViewControl.onReady.add(() => {
print("onReady")
this.webViewControl.loadUrl("https://snap.com")
})
},
(msg: string) => {
print(`Error: ${msg}`)
}
)

Hierarchy (View Summary, Expand)

Constructors

Properties

canGoBack: boolean

Check if there is any back history on the web stack.

canGoForward: boolean

Check if there is any forward history on the web stack.

onReady: event0<void>

This event signals that the webview is ready for performing actions such as loadUrl, etc. This also is when the WebView should be visible on the Texture that was originally provided.

Methods

  • Experimental

    Returns the texture's aspect ratio, which is calculated as width / height.

    Returns number

  • Experimental

    Returns the height of the texture in pixels.

    Returns number

  • Experimental

    Get the current user-agent for the webview.

    Returns string

  • Experimental

    Returns the width of the texture in pixels.

    Returns number

  • Experimental

    Navigate back in the web history.

    Returns void

  • Experimental

    Navigate forward in the web history.

    Returns void

  • Experimental

    Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Experimental

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

  • Experimental

    Request a url to be loaded.

    Parameters

    • url: string

    Returns void

  • Experimental

    Request the current page to be reloaded.

    Returns void

  • Experimental

    Set a custom user-agent for the webview.

    Note: By default all webviews will have the same user-agent set by the platform. This can be used to target Spectacles specific websites.

    Parameters

    • userAgent: string

    Returns void

  • Experimental

    Request the current page loading to stop.

    Note: Has no effect if the page is already loaded.

    Note: Does not stop scripts on the webpage.

    Returns void

  • Experimental

    Touch will allow the lens creator to pass input events from the Lens to the WebView.

    • id: of the touch (in the case of multi-finger, etc), for continuous interactions it is required they share the same id.
    • state: What type of action is preformed.
    • x: the x coordinate of the touch, in WebView space (2d).
    • y: the Y coordinate of the touch, in WebView space (2d).

    Note: Using the WebView from the Asset Library will have already implemented this logic with SIK and Hand Tracking and Mobile Controller and it is not expected for creators to re-implement this handling unless they wish to provide further customization and options.

    Parameters

    Returns void

MMNEPVFCICPMFPCPTTAAATR