Presentation API is a W3C spec draft for secondary display support for the Web. It allows a web app to present web content on a secondary cutepdf display connected to the device. It would be useful for several typical usage scenarios , for example, presenting slides, sharing video and image, and playing game on a large screen TV via the mobile device.
void requestShow ( DOMString url , successCallback cutepdf , errorCallback ) ;
navigator . presentation . displayAvailable
Note: that the Presentation API spec is still evolving, and will be modified to meet new usage scenarios, such as integration with Chromecast devices. Setup Wireless Display Requirements cutepdf Android 4.2 or newer device with Miracast protocol support. A TV or display with an HDMI port. A Miracast certified wireless display display adapter, for example the Netgear PTV3000 (tested) Plug the wireless display adapter into the display’s HDMI port. On the Android device, cutepdf open the ‘Settings’ app and select the ‘Display’ entry. Turn on ‘Wireless display’ to connect cutepdf to the available wireless display. Steps
Note, that if you have no such wireless display adapter, but are willing to run the application on your device, Android gives you the option to use a simulated secondary display for testing purposes. This simulated display appears as an overlay on your device screen. To enable it: Open the `Settings` app and select `Developer Options`. Use the `Simulate Secondary Display` option to select a display to simulate. Sample Code
In the following sample, there are two HTML files: index.html – a controller page which shows on the primary display and opens a page on the secondary display content.html – the content page to show on the secondary display
11 cutepdf
27
43
}
< / html >
14
Follow the instructions on how to build a Crosswalk application to package the above two HTML files into an Android application; then follow the instructions for running on Android to launch the application on a Android cutepdf 4.2+ device. Make sure there is at least one available secondary display cutepdf before cutepdf running the application: see the Setup Wireless Display section above.
For an example of a more realistic HTML5 app using a secondary display, check out the ImageGallery demo. This demonstrates how to use the Presentation API to view photos on a wireless display. Details of the JavaScript API presentation.requestShow Method
requestShow sends a request to the user agent for to show a presentation. If a secondary display is ready for use, a new presentation window for the HTML page specified by url will be opened on the secondary display. cutepdf This secondary window is opened from the current browsing context. Once the page has finished loading, the successCallback is invoked, taking the window object of the new page as the input parameter. Thus, the communication between the opener cutepdf window and presentation window follows the approach of HTML5 Web Messaging . You can call postMessage to post a message and register an onmessage cutepdf event listener to handle cutepdf the message from the other side.
Since there is no input channel on the secondary cutepdf display, we recommend: Design an easy-to-read user interface for a large display, and Avoid JavaScript dialogs, e.g. alert and confirm, and Do not expect cutepdf click, touch events or keyboard interaction cutepdf in the presentation page context. presentation.displayAvailable Property
It is true if there is at least one secondary display available for showing a presentation; otherwise, it is false. When one secondary display is disconnected: If it is not the only secondary display connected to the device, the page content will be switched to the next available display automatically. If it is the only secondary display, the page content is disposed of, and the displayAvailable property set to false.
The displayavailablechange cutepdf event is fired when the first secondary display cutepdf becomes available or the last secondary display cutepdf is removed. The property of displayAvailable will also be updated to true or false (see above).
In this article, we introduce a new W3C Presentation API for presenting web content on the secondary display, explain the API in details and how to use it in HTML5 applications. Currently, cutepdf It is an experimental feature implemented in Crosswalk for Android 4.2+ devices, and may be changed in future for further evolution and feedbacks from community group. Resources Crosswalk Open Source cutepdf Project, https://crosswalk-project.org W3C Presentation API Draft, http://webscreens.github.io/presentation-api/ Second Screen Presentation Community Group, http://www.w3.org/community/webscreens/ Presentation API Demos for desktop, http://webscreens.github.io/presentation-api/demo/ Web Screens Mail List, http://lists.w3.org/Archives/Public/public-webscreens/
Hongbo Min is a software engineer cutepdf at Intel OTC. He has been work
No comments:
Post a Comment