0

I'm trying to create an hybrid app using Ionic 5 that will cast some media. From docs

The Chrome Sender API consists of two parts: the Framework API (cast.framework) and the Base API (chrome.cast)

I'm trying to find cordova plugin that provides me this functionality. Couple I've tried (like https://github.com/jellyfin/cordova-plugin-chromecast) have only the Base API (chrome.cast), but not the framework.

Is there any cordova plugin that provides both APIs or any other way of enabling framework?

I have also tried to use google lib for it: https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1 but it requires navigator.Presentation to be accessible and it doesn't exist on WebView (also couldn't find any cordova plugin that provides navigator.Presentation).

Baumi
  • 1,745
  • 1
  • 17
  • 31
  • I think cordova itself is using presention to work inside webview and to work with native hardware api's. And it is navigator.presentation in lowercase , i will post in second comment an example. – Mostafa Harb Mar 27 '20 at 09:24
  • navigator.presentation.receiver.connectionList.then(function (list) { list.connections.map(function (connection) { addConnection(connection); }); list.onconnectionavailable = function (evt) { addConnection(evt.connection); }; }); – Mostafa Harb Mar 27 '20 at 09:24
  • @Baumi Did you find any solution – Praful Kadam Jan 05 '21 at 13:21
  • @PrafulKadam Finally I made it working using `cordova-plugin-chromecast` posted in original question and using functionalities only from `chrome.cast`. End the end of the day this was sufficient for me. – Baumi Jan 07 '21 at 14:18
  • @Baumi I get chrome is undefined error, do you know what's the issue – Praful Kadam Jan 07 '21 at 17:01
  • Are you adding https://www.gstatic.com/cv/js/sender/v1/cast_sender.js in your index file? – Baumi Jan 07 '21 at 18:58
  • Also make sure to add attribute `data-cast-api-enabled="true"` to your head element in index file. – Baumi Jan 11 '21 at 08:50

0 Answers0