cordova-plugin-presentation
cordova-plugin-presentation copied to clipboard
Use plugin on demand
Hi all, thank you for your excellent cordova plugin; I'm using it in my iOS app and it works very well, but I have one request. When I open my app the plugin starts to work immediately showing the splashscreen in the second view; is possible to use native iOS duplication mode instead and start the plugin "on demand", e.g. when I press a button on main iPad view?
Thank you very much
Hi, technically your request is definitely possible and i like the idea of introducing more control. We set the default display page for the secondary display at https://github.com/fraunhoferfokus/cordova-plugin-presentation/blob/0487aaf111352c201859114341405f9642677a26/www/presentation.js#L66 Let us think a little about the impact of this request towards the W3C Presentation API. It might be that this request could be valuable input for the working group. @louaybassbouss what do you think? BR
Agree with @mlasak technically is possible. The reason why we use a default page is to put a generated name of the Display since on iOS it is not possible to access the name of the Apple TV or even to know if the connection to second display is via Airplay or wired. I think the best way is to define a settings property called "defaultDisplay" and if it is undefined the mirroring mode is used.
BR
How about the following change. We could delay the default display presentation to the moment when requestSession
is called by the application. In case mirroring was already activated we show the default display having the generated name for the identification purpose.
@lcaprini would that fit your needs?
BR
Thank you all and sorry for my the delay but I missed tha last comment :( Suppose I connect my iPad to an AppleTV: the idea is to activate mirroring on iOS and view on AppleTV all I see in my iPad, as usual. Also when I open my Cordova application the AppleTV continues to show mirrored iPad screen, so without any change. Now I would like to use a simple button to start your plugin (generating a 'requestSession' event?) and show the 2nd view on AppleTV; with the same button also I would like to stop the plugin (generating an event like 'destroySession' ?) and return to show the normal native iOS mirroring. With your modifications is possible to have this behaviour?
Thank you all and best regards
This is definitely possible and doable as you describe. For closing and going back to default mirroring mode you would then simply use the PresentationSession.close function.
BR
Wonderful! Thank you very much. When you expect to release the new version with this feature?
BR
@lcaprini FYI: The W3C Presentation (https://www.w3.org/TR/presentation-api/) will become a Recommendation soon (end of the year) and we will then publish a new version of the plugin that is fully compatible with the new version which also bring some new features which are not supported in the current version which implements an older version of the Presentation API Specification (https://www.w3.org/2014/secondscreen/presentation-api/20140721/)