Git Product home page Git Product logo

cordova-chromecast's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-chromecast's Issues

Tag stable versions

Any chance of creating tags of stable versions? It would be very useful for dependency management.

App crashes on chrome.cast.requestSession

Managed to get everything set up but after i select 'Home' (my chromecast) in the list It gets a stopped responding and crashes.

Update: I didn't add the line for what google play services version to use. Updated and working great.

Not working anymore with latest android support and/or google play libs

Hi,
your plugin was working great until i updated the android libs (support libs are now 21.0.3, google play service is on 22) and added the new libs to the project.

What happens is that everything looks fine, the chromecast-app is getting started, but loadMedia returns an "Unknown" error and is not able to reach the chromecast (I dont see any response on the chromecast debugger). Using sendMessage works (i get the messoge on the chromecast) but also returns an "Unknown" error and no session is available.

Any ideas why?
I am using cordova 4.x and android platform for cordova 3.7.1. If you need more information i am very happy to provide it!

Would be great if you could fix this!

Thank you!

not working on IOS

Hi,
Im working on an hybrid app which has chrome cast integration. It works OK in android, ( using this cordova plugin ), but in IOS is not working, the error code is "api_not_initialized".

Is it necessary do something special for IOS, or this plugin will not work for IOS ?

Thanks, Maxi.

Can't compile on Cordova 6.1

Hi

I'm not able to build the application on Cordova 6.1 with Android SDK 23. I'm using Ionic 1 framework to build a hybrid mobile app.
Here's the error from console:

MY_PROJECT\platforms\android\build\intermediates\manifests\full\debug\AndroidManifest.xml:45:28-65 : AAPT: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

I tried to cheat so I hardcoded Google Play Services version in 'MY_PROJECT/platforms/android/android.json' file.
This solves the issue but then I ran into another one:

MY_PROJECT/platforms\android\src\acidhax\cordova\chromecast\Chromecast.java:12: error: package com.google.android.gms.cast does not exist import com.google.android.gms.cast.CastMediaControlIntent;

I checked the file mentioned above and 'com.google.android.gms.cast.CastMediaControlIntent' is imported so I'm not sure what's the problem.

I also tried to implement solution #59 but it didn't help.

Does anybody know where is the problem?
Thanks

Andriod Version 5.0 issues

I am getting a lot of errors on android 5 when casting. I can cast but the media controls fail to work. Can anyone confirm this issue?

Media update listener not being called

I've been debugging an issue with my app that relies on the a listener function that gets called when the current media is updated.

My problem is this listener is not getting called.

Once media is successfully loaded I add a listener to it using .addUpdateListener().

Here are the relevant parts of my code:

castService.session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError);

function onMediaDiscovered(how, mediaSession) {
    console.log('new media session ID:' + mediaSession.mediaSessionId);
    castService.currentMediaSession = mediaSession;
    castService.currentMediaSession.addUpdateListener(onMediaStatusUpdate);
}

function onMediaStatusUpdate(isAlive) {
    console.log('onMediaStatusUpdate was called);
}

onMediaStatusUpdate() doesn't seem to fire in @Vaporexpress sample project either https://github.com/Vaporexpress/Cordova-CastVideos-chrome
I just checked by adding a console.log() inside the function.

cordova run command fails

Please see Gist here:
https://gist.github.com/dberube/27b18797ba0c95d10e10

cordova run errors with:

BUILD FAILED
/Users/david/Android/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Users/david/Android/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 3 seconds

/Users/david/Mobile/TestApp/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Users/david/Mobile/TestApp/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/david/Mobile/TestApp/platforms/android/cordova/run: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Might be related to my other issue of not appearing to be able to add Google Play Services plugin (another Issue).

Metadata.images not showing on chromecast?

// Note: I'm not totally sure if it's just me doing something wrong or if this is an actual issue. So I guess I'd just ask it..

I'm trying to show album art on a (default) Styled Media Receiver

I have the following code in js:

// Note: station = { station_url = 'http://url.to.station/stream.m3u', station_icon = 'http://url.to.station/image.png' }

var mediaInfo = new chrome.cast.media.MediaInfo(station.station_url);
mediaInfo.contentType = "audio/mpeg";

mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata();
mediaInfo.metadata.metadataType = chrome.cast.media.MetadataType.GENERIC;
mediaInfo.metadata.title = station.station_name;
mediaInfo.metadata.subtitle = "Icerrr Chromecast";
mediaInfo.metadata.images = [{'url': station.station_icon}];

var request = new chrome.cast.media.LoadRequest(mediaInfo);
request.autoplay = true;

// debug    
console.log(" > Metadata Image: "+ mediaInfo.metadata.images[0].url);

site.cast.session.loadMedia(request,
    function(media) {
    site.cast.media = media;
    site.cast.media.addUpdateListener(site.cast.mediaUpdateListener);
    site.cast.updateicon(2);
    site.cast.play();
    },
site.cast.onerror
);

It all works perfectly but it won't show the album art. The app that casts it (and executes the code above) uses the exact same url and that works...

I've also checked the developer console of the chromecast and it doesn't give show any errors/warnings related to the images (it did complain about css images not being loaded over https)

Reproduce the problem:
Get the app (Icerrr): https://play.google.com/store/apps/details?id=com.rejh.icerrr.droidapp
Use the cast button in the top corner

iOS?

Is anyone already working on iOS integration? Just trying to get a feel for whether or not this is going to happen any time soon.

Not all android versions supported?

Are all android versions supported? Because the app i build works like a charm on 2 devices, so we ordered 2 new devices, but on both devices no receivers can be found.

The devices are both on the correct network and apps like youtube find the receiver as it should.

On one device the logcat outputs a Calling a method in the system process without a qualified user error. On the other no error was triggered it simple doesn't find the receiver.

Is it that not all android versions are supported or is it something is the settings of the new devices?

Route is not removed when chromecast is turned off

I noticed the route is not removed when the Chromecast is turned off. It keeps there as if there was a Chromecast available.

It used to work, so maybe it's a Google Play Services/Cast service related issue? Or maybe the updated libraries.

Can anybody check? @acidhax

Get a null pointer exception one a Nexus 5

I've tried the same Chromecast app on several devices and it works great. However, on one Nexus 5 the app crashes just before showing the pop up window that lists the chromecasts. Can't figure out why. Here's the stack trace:

W/dalvikvm(21982): threadid=1: thread exiting with uncaught exception (group=0x415ccba8)
E/AndroidRuntime(21982): FATAL EXCEPTION: main
E/AndroidRuntime(21982): Process: com.osborn.jude, PID: 21982
E/AndroidRuntime(21982): java.lang.NullPointerException
E/AndroidRuntime(21982):    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
E/AndroidRuntime(21982):    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
E/AndroidRuntime(21982):    at android.widget.AbsListView.obtainView(AbsListView.java:2255)
E/AndroidRuntime(21982):    at android.widget.ListView.measureHeightOfChildren(ListView.java:1263)
E/AndroidRuntime(21982):    at android.widget.ListView.onMeasure(ListView.java:1175)
E/AndroidRuntime(21982):    at android.view.View.measure(View.java:16497)
E/AndroidRuntime(21982):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
E/AndroidRuntime(21982):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
E/AndroidRuntime(21982):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
E/AndroidRuntime(21982):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
E/AndroidRuntime(21982):    at android.view.View.measure(View.java:16497)
E/AndroidRuntime(21982):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
E/AndroidRuntime(21982):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
E/AndroidRuntime(21982):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
E/AndroidRuntime(21982):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
E/AndroidRuntime(21982):    at android.view.View.measure(View.java:16497)
E/AndroidRuntime(21982):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
E/AndroidRuntime(21982):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(21982):    at android.view.View.measure(View.java:16497)
E/AndroidRuntime(21982):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
E/AndroidRuntime(21982):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(21982):    at android.view.View.measure(View.java:16497)
E/AndroidRuntime(21982):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
E/AndroidRuntime(21982):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
E/AndroidRuntime(21982):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
E/AndroidRuntime(21982):    at android.view.View.measure(View.java:16497)
E/AndroidRuntime(21982):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
E/AndroidRuntime(21982):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1084)
E/AndroidRuntime(21982):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
E/AndroidRuntime(21982):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
E/AndroidRuntime(21982):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
E/AndroidRuntime(21982):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
E/AndroidRuntime(21982):    at android.view.Choreographer.doCallbacks(Choreographer.java:574)
E/AndroidRuntime(21982):    at android.view.Choreographer.doFrame(Choreographer.java:544)
E/AndroidRuntime(21982):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
E/AndroidRuntime(21982):    at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime(21982):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(21982):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(21982):    at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime(21982):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(21982):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(21982):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime(21982):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime(21982):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  759):   Force finishing activity com.osborn.jude/.socialcinema
D/dalvikvm( 1106): GC_FOR_ALLOC freed 873K, 22% free 19761K/25284K, paused 17ms, total 17ms
D/dalvikvm(  759): GC_FOR_ALLOC freed 1812K, 20% free 52233K/64644K, paused 88ms, total 88ms
D/dalvikvm( 1106): GC_CONCURRENT freed 995K, 22% free 19768K/25284K, paused 2ms+3ms, total 31ms
W/ActivityManager(  759): Activity pause timeout for ActivityRecord{43856618 u0 com.osborn.jude/.socialcinema t87 f}
D/LauncherAppState( 1078): setPackageState(com.hg.rocketislandfree, -1)
W/HandlerScheduledExecuto( 1078): Task does not implement UiTask. Consider using NamedUiRunnable for com.google.android.sidekick.shared.client.bf@42ea0708

Strange problem detecting available Chromecasts

Issue reproduced on the following devices using an unsigned debug APK:
LG G3 S (4.4.4)
Galaxy S5 (4.4.4)

Could not reproduce on:
Nexus 4 (4.4.4 & 5.0)
Nexus 6 (5.0)
Nexus 7 (4.4.4)
Galaxy Ace (4.4.4)
Galaxy S3 (4.2)

Steps to reproduce:
Open app, connect to a Chromecast (using standard requestSession)
End/close the app (holding down home button/using menu button and swiping to remove the app)
This will also close the receiver file as number of senders=0 using window.close()
Open the app again and a Chromecast won't be found
To fix this issue requires re-installing the app or clearing the apps cache

Is this an issue with this plugin or are we doing something wrong?

doesn't work with ionic

Hi,

I am trying to use this plugin in ionic framework(http://ionicframework.com/), but it is broken. I think the problem is that the ionic currently only supports android-19 but this plugin requires android-21.

Is there a way I can get around?

Errorcode: 51 upon requestSession

Hi!
Thanks for bringing chromecast to Cordova.
I'm having problems getting a Session though.
Upon the extecution of the function chrome.cast.requestSession(), an error with the code 51 is thrown.
I'm looking forward to your help. Thank you!

alert('CAST available:' + chrome.cast.isAvailable); //returns true

new chrome.cast.SessionRequest(chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID);

var apiConfig = new chrome.cast.ApiConfig(sessionRequest, function(session) {
    alert('CAST: Session initialised'); 
}, function(available) {
    alert('CAST: Reciever?' + (chrome.cast.ReceiverAvailability.AVAILABLE === available));
});

if (!chrome.cast || !chrome.cast.isAvailable) {
  setTimeout(chrome.cast.initialize(apiConfig, 
    function() {
      alert('initialize done');
    }, function(err) {
      alert('initialize error', err);
    }),3000);
}

chrome.cast.requestSession(function(session) {
      //some code
   }, function(err) {
     console.log('request session error', err); // <--- Error thrown
  });

App crashes with error 2005 on selecting chromecast device

I compiled with cordova , and my app has JWPlayer in it .
The player has chromecast support.

When trying to cast from it through the extension i get :
1.) on the first try
initialize origin_scoped 3DAE6C71 3DAE6C71
tracker.js:10 lastAppId 3DAE6C71
tracker.js:10 Attempting to join route Chromecast5980
tracker.js:10 sessionJoinAttempt error Status{statusCode=unknown status code: 2005, resolution=null}

then it keeps throwing the error
tracker.js:10 Attempting to join route Chromecast5980
tracker.js:10 sessionJoinAttempt error Status{statusCode="unknown status" code: 2005, resolution=null}

when clicking a second time the app crashes.

What can cause that ?

everything is compiled with SDK21 (including all the libraries)
I ran ant clean+debug build on all the libraries
Currently testing on Nexus4/Android5.0.1

Can't build it for Android, see my video (Cordova chromecast plugin)

Hey, took me a while to even find out what's the problem and it seems that I can't build my project for Android as soon as I add your plugin. Am I doing something wrong? Plugin works when starting index.js with "node index.js" on localhost.

Here is my video: https://goo.gl/KEUYgs

If I remove the plugin with "plugin remove acidhax.cordova.chromecast" and then "cordova rm android" and "cordova add android" again -> building works.

Deprecated "sendJavascript" in CordovaWebView

First of all, thanks for your great work.
FYI, in your plugin code you use "sendJavascript" which is deprecated in CordovaWebView.java where i can see:
/**
* Send JavaScript statement back to JavaScript.
* Deprecated (https://issues.apache.org/jira/browse/CB-6851)
* Instead of executing snippets of JS, you should use the exec bridge
* to create a Java->JS communication channel.
* To do this:
* 1. Within plugin.xml (to have your JS run before deviceready):
*
* 2. Within your .js (call exec on start-up):
* require('cordova/channel').onCordovaReady.subscribe(function() {
* require('cordova/exec')(win, null, 'Plugin', 'method', []);
* function win(message) {
* ... process message from java here ...
* }
* });
* 3. Within your .java:
* PluginResult dataResult = new PluginResult(PluginResult.Status.OK, CODE);
* dataResult.setKeepCallback(true);
* savedCallbackContext.sendPluginResult(dataResult);
*/
Maybe this is the cause that sometimes the follow warning is raised by function "emitAllRoutes":
"W/PluginManager﹕ THREAD WARNING: exec() call to Chromecast.emitAllRoutes blocked the main thread for 21ms. Plugin should use CordovaInterface.getThreadPool().".

http://www.donmarges.io/thread-warning-exec-call-blocked-the-main-thread-plugin-should-use-cordovainterface-getthreadpool-cordova-plugin-warning/

PD: Sorry my bad english.

_routeListEl.classList.add not supported on older phones

On my old test phone running Andriod 2.3 does not have chrome install and the classList.add method is not available. Here is my fix. I do not use the route list method but this does resolve the error I am getting.

Replace in chrome.cast.js
_routeListEl.classList.add('route-list');

With
if(typeof _routeListEl.classList!='undefined') {
_routeListEl.classList.add('route-list');
}else {
_routeListEl.classList += 'route-list';
}

App crashes on chrome.cast.initialize

First off: Great work! It's about time that Chromecast support becomes available for Cordova 👍

However, I have trouble getting your plugin to work :(

I set up my Cordova project with the needed library projects in project.properties:

  android.library.reference.1=CordovaLib
  android.library.reference.2=../android/extras/google/google_play_services/libproject/google-play-services_lib
  android.library.reference.3=../android/extras/android/support/v7/appcompat
  android.library.reference.4=../android/extras/android/support/v7/mediarouter

and it compiles just fine.
But when I try to use the chrome.cast.* API like this:

  onDeviceReady: function() {
     var sessionRequest = new chrome.cast.SessionRequest("794B7BBF");
     var apiConfig = new chrome.cast.ApiConfig(sessionRequest, function sessionCallback(session) {
      console.log(">> SESSION CALLBACK", session);
    }, function receiverAvailable(recv) {
      console.log(">> RECEIVER AVAILABLE", recv);
    });

    chrome.cast.initialize(apiConfig, function success() {
      console.log(">> INIT SUCCESS");
    }, function error(err) {
      console.log(">> INIT ERR: ", err);
    });
  }

I get the following from adb logcat when I launch the app:

  E/AndroidRuntime( 5759): Process: io.cordova.hellocordova, PID: 5759
  E/AndroidRuntime( 5759): java.lang.NoClassDefFoundError:   android.support.v7.mediarouter.R$string
  E/AndroidRuntime( 5759):  at android.support.v7.media.SystemMediaRouteProvider$JellybeanImpl.<init>(SystemMediaRouteProvider.java:256)
  E/AndroidRuntime( 5759):  at android.support.v7.media.SystemMediaRouteProvider$JellybeanMr1Impl.<init>(SystemMediaRouteProvider.java:716)
  E/AndroidRuntime( 5759):  at android.support.v7.media.SystemMediaRouteProvider$JellybeanMr2Impl.<init>(SystemMediaRouteProvider.java:788)
  E/AndroidRuntime( 5759):  at android.support.v7.media.SystemMediaRouteProvider.obtain(SystemMediaRouteProvider.java:53)
  E/AndroidRuntime( 5759):  at android.support.v7.media.MediaRouter$GlobalMediaRouter.<init>(MediaRouter.java:1410)
  E/AndroidRuntime( 5759):  at android.support.v7.media.MediaRouter.getInstance(MediaRouter.java:166)
  E/AndroidRuntime( 5759):  at acidhax.cordova.chromecast.Chromecast$4.run(Chromecast.java:225)
  E/AndroidRuntime( 5759):  at android.os.Handler.handleCallback(Handler.java:733)
  E/AndroidRuntime( 5759):  at android.os.Handler.dispatchMessage(Handler.java:95)
  E/AndroidRuntime( 5759):  at android.os.Looper.loop(Looper.java:136)
  E/AndroidRuntime( 5759):  at android.app.ActivityThread.main(ActivityThread.java:5017)
  E/AndroidRuntime( 5759):  at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime( 5759):  at java.lang.reflect.Method.invoke(Method.java:515)
  E/AndroidRuntime( 5759):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  E/AndroidRuntime( 5759):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  E/AndroidRuntime( 5759):  at dalvik.system.NativeStart.main(Native Method)
  W/ActivityManager(  598):   Force finishing activity io.cordova.hellocordova/.HelloCordova

Thanks for help troubleshooting this one!

Getting unknown error from loadMedia

var mediaInfo = new chrome.cast.media.MediaInfo(videoUrl);
var request = new chrome.cast.media.LoadRequest(mediaInfo, function(){console.log('yes')},function(e){console.log(e)});
_session.loadMedia(request, function(){console.log('yes')},function(e){console.log(e)});

mediainfo:

chrome.cast.media.MediaInfo {contentId: "http://usher.justin.tv/api/channel/hls/vman7.m3u8?…e%7D&sig=0d4dfbf96bfd110ad44c50ae7ce7087aa7c65cc8", streamType: "live", contentType: "audio/x-mpegURL", metadata: null, duration: null…}
contentId: "http://usher.justin.tv/api/channel/hls/vman7.m3u8?token=%7B%22user_id%22%3Anull%2C%22channel%22%3A%22vman7%22%2C%22expires%22%3A1397510607%2C%22chansub%22%3A%7B%22view_until%22%3A1924905600%2C%22restricted_bitrates%22%3A%5B%5D%7D%2C%22private%22%3A%7B%22allowed_to_view%22%3Atrue%7D%2C%22privileged%22%3Afalse%7D&sig=0d4dfbf96bfd110ad44c50ae7ce7087aa7c65cc8"
contentType: "audio/x-mpegURL"
customData: null
duration: null
metadata: null
streamType: "live"
proto: Object

request:

chrome.cast.media.LoadRequest {type: "LOAD", currentTime: null, customData: null, requestId: null, sessionId: null…}
autoplay: true
currentTime: null
customData: null
media: chrome.cast.media.MediaInfo
requestId: null
sessionId: null
type: "LOAD"
proto: Object

session media data is missing when joining session (e.g. after page reload)

the media property of the session is always empty when in cordova app.

steps to reproduce:

  1. run sample app from Vaporexpress with cordova
  2. play video on chromecast
  3. open chrome devtools and reload page

then the session is joined successfully, but the media property is an empty array,
so there is no chance to play/pause/seek

but that works when testing on desktop chrome.
also, if starting playback, the session update listener gets no media property.
only chance is to take it from media load success callback

Cordova 4.3.0
Android 5.1

Cant able to take build after installing our plugins.

I initially have installed
Step 1: cordova plugin add https://github.com/GetVideostream/cordova-chromecast.git
Step 2: cordova plugin add https://github.com/pkaul/googleplayservices-cordova-plugin.git

After installing above plugin I cant able to take the build.

Error am getting is.

BUILD FAILED
'/home/gladson/adt-bundle-linux-x86_64-20140702/sdk/tools/ant/build.xml:720: The following error 'occurred while executing this line:
/home/gladson/adt-bundle-linux-x86_64-20140702/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 4 seconds

/var/www/ionic/testcast/mycast2/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/var/www/ionic/testcast/mycast2/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /var/www/ionic/testcast/mycast2/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Please let me know how to fix it. When am taking the build am getting lot of log like

[javac] /var/www/ionic/testcast/mycast2/platforms/android/src/acidhax/cordova/chromecast/ChromecastSession.java:16: error: package com.google.android.gms.cast does not exist
[javac] import com.google.android.gms.cast.MediaInfo;
[javac] ^
[javac] /var/www/ionic/testcast/mycast2/platforms/android/src/acidhax/cordova/chromecast/ChromecastSession.java:17: error: package com.google.android.gms.cast does not exist
[javac] import com.google.android.gms.cast.MediaStatus;

etc......

Plugin incompatibility with some devices

Some users on my app are complaining about their Chromecast 2 devices not being recognized. I can't test because mine is the classic one. Anybody else got this?

App crashes when another app is using Chromecast

The app will crash when another app like youtube is connected to chromecast. To reproduce quit Youtube and your app. Open your app (do not connect to chromecast). Open Youtube, connect to chromecast, then try to connect to chromecast with your app. See Error below.

06-24 16:29:53.457: E/AndroidRuntime(21889): FATAL EXCEPTION: main
06-24 16:29:53.457: E/AndroidRuntime(21889): Process: com.phonegap.myvidster, PID: 21889
06-24 16:29:53.457: E/AndroidRuntime(21889): java.lang.NullPointerException
06-24 16:29:53.457: E/AndroidRuntime(21889): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
06-24 16:29:53.457: E/AndroidRuntime(21889): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
06-24 16:29:53.457: E/AndroidRuntime(21889): at android.widget.AbsListView.obtainView(AbsListView.java:2255)
06-24 16:29:53.457: E/AndroidRuntime(21889): at android.widget.ListView.measureHeightOfChildren(ListView.java:1263)
06-24 16:29:53.457: E/AndroidRuntime(21889): at android.widget.ListView.onMeasure(ListView.java:1175)

Trouble getting a valid session

I've setup my app using Google's example HTML and JS from here:

https://github.com/googlecast/CastHelloVideo-chrome

I have chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError); wired to a button as in the example. The popup appears with my Chromecast listed but once I select it and the popup dismisses then nothing happens. Neither the success nor error handlers are triggered, no timeout etc.

If I call it a second time the success handler is triggered but I don't have a valid session, no sessionId etc.

Any thoughts?

Empty error info from handleError()

in handleError():

  var error = new Error(errorCode, errorDescription, errorData);

should be

  var error = new chrome.cast.Error(errorCode, errorDescription, errorData);

Import Library Projects

This might be a dumb question or request but could you explain how to import the library projects. I don't think the node build process imported them and I need to do it manually.

adt-bundle\sdk\extras\google\google_play_services\libproject\google-play-services_lib
adt-bundle\sdk\extras\android\support\v7\appcompat
adt-bundle\sdk\extras\android\support\v7\mediarouter

Can't compile on Cordova 5.2

Hi,

Thanks for this fantastic plugin.

Everything works OK in cordova 4.3 but today i've tried on another machine with latest 5.2 and it fails to build. I've asked on StackOverflow:

http://stackoverflow.com/questions/32166984/cordova-plugin-getvideostream-chromecast-works-on-4-3-but-doesnt-compile-on-5

Any help would be much appreciated. Thanks.

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] C:\Users\Gianni\Desktop\hello\platforms\android\libs\AppCompatLib\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
     [aapt]
     [aapt] C:\Users\Gianni\Desktop\hello\platforms\android\libs\AppCompatLib\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
     [aapt]

Exec:
BUILD FAILED
E:\AndroidSDK\tools\ant\build.xml:649: The following error occurred while executing this line:
E:\AndroidSDK\tools\ant\build.xml:694: null returned: 1

Total time: 0 seconds

Error: Exec: Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "ant release -f ./platforms/android/libs/AppCompatLib/build.xml"

BUILD FAILED
E:\AndroidSDK\tools\ant\build.xml:649: The following error occurred while executing this line:
E:\AndroidSDK\tools\ant\build.xml:694: null returned: 1

Total time: 0 seconds

    at C:\Users\Gianni\Desktop\hello\plugins\acidhax.cordova.chromecast\init-playservices-dependencies.js:53:19
    at ChildProcess.exithandler (child_process.js:758:5)
    at ChildProcess.emit (events.js:129:20)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

Can not get it to Install

Any help would be greatly appreicited,

cordova plugin add https://github.com/GetVideostream/cordova-chromecast.git
Fetching plugin "https://github.com/GetVideostream/cordova-chromecast.git" via git clone
Installing "acidhax.cordova.chromecast" for android
Found Android SDK at /opt/android-sdk-linux
Executing /opt/android-sdk-linux/tools/android update lib-project -p ./platforms/android/AppCompatLib ...
Failed to install 'acidhax.cordova.chromecast':Error: spawn EMFILE
at errnoException (child_process.js:988:11)
at ChildProcess.spawn (child_process.js:935:11)
at exports.spawn (child_process.js:723:9)
at Object.exports.execFile (child_process.js:607:15)
at exports.exec (child_process.js:578:18)
at execCommand (/home/tholum/Documents/Projects/MyApp/plugins/acidhax.cordova.chromecast/init-playservices-dependencies.js:44:13)
at prepareLibraryProject (/home/tholum/Documents/Projects/MyApp/plugins/acidhax.cordova.chromecast/init-playservices-dependencies.js:73:5)
at Object. (/home/tholum/Documents/Projects/MyApp/plugins/acidhax.cordova.chromecast/init-playservices-dependencies.js:170:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Error: spawn EMFILE
at errnoException (child_process.js:988:11)
at ChildProcess.spawn (child_process.js:935:11)
at exports.spawn (child_process.js:723:9)
at Object.exports.execFile (child_process.js:607:15)
at exports.exec (child_process.js:578:18)
at execCommand (/home/tholum/Documents/Projects/MyApp/plugins/acidhax.cordova.chromecast/init-playservices-dependencies.js:44:13)
at prepareLibraryProject (/home/tholum/Documents/Projects/MyApp/plugins/acidhax.cordova.chromecast/init-playservices-dependencies.js:73:5)
at Object. (/home/tholum/Documents/Projects/MyApp/plugins/acidhax.cordova.chromecast/init-playservices-dependencies.js:170:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)

no media callback on already active session

My final question, the _session, if you connect with an already active session, doesn't call back any information on the current playing media. Which means I can't change volume or stop it. In the Chrome api it says this: if (session.media.length != 0) , however session.media is not defined.

Installing Java Dependencies

Sorry if this is slightly newbish, but I'm not an Android developer, and am really struggling with the library project dependencies. I spent nearly a full day trying to figure out how to get them to install, but I always get " com.google.android.gms.cast does not exist" (along with billions of other dependency errors) when running "cordova run android".

Most of the info I've found on line has been related to Eclipse and Android Studio, but I did find a bit of info about how to install libraries via the command line. What I'm doing is copying the three libraries from the SDK folder to my Cordova folder and then running this inside each folder:

android update lib-project --target android-19 -p .

It's not clear to me exactly where I need to copy these folders, but the commands appear to run successfully. I've also found information about attaching appcompat to mediarouter by adding a path to project.properties. However, no matter what I do or how I do it I get the same error. Is there any chance you might be able to help me get these dependencies going? My team is really interested in this plug-in, and is likely to use it extensively if we can get it working. Thanks VERY much.

License

Hi folks, would it be possible to indicate the license, so I can fork a version with updates and send a pull request to you project?

Code example?

Would you happen to have a code example where chromecast is working? When I try chrome.cast.initialize() I get the error callback with "api_not_initialized". I've followed the initialization code in tests.js (which is basically the Chrome API). For example, I tried putting this in the bindEvents function:

        document.addEventListener('click', function() {
            var applicationID = 'CC1AD845';

            var sessionRequest = new chrome.cast.SessionRequest(applicationID);

            var apiConfig = new chrome.cast.ApiConfig(sessionRequest, function(session) {
                console.log('sessionCallback');
            }, function(available) {
                console.log('receiverCallback');
            });

            chrome.cast.initialize(apiConfig, function() {
                console.log('initialize done');
            }, function(err) {
                console.log('initialize error', err);
            });
        });

This results in "initialize error' in the console when touching the app. I do have a working Chromecast running on the same network as the phone to which the cordova app is deployed, and the phone can connect using other apps like YouTube, but not a deployed cordova app with this extension. Maybe I'm integrating it wrong somehow. A working code example would be awesome.

Error When Adding Play Services

Please see Gist: https://gist.github.com/dberube/397e37c66a8d760d86ea

Running:
cordova plugin add https://github.com/pkaul/googleplayservices-cordova-plugin.git#1.0.0

Does some stuff, but errors with:
Error: ENOENT, open '/Users/david/Android/sdk/extras/google/google_play_services/libproject/google-play-services_lib/'

Going to be using this with Ionic v1.3-beta1 and Cordova v4.1.2

Any help would be greatly appreciated -- maybe even some examples of how to integrate -- thanks!

Session creation does not work as expected in Chrome app for mobile

I have successfully used the plugin for cordova projects but once the same thing is built with cca (chrome apps for mobile which bundles crosswalk with cordova) something strange happens to sessions: calling createSession is called and no error is given but the callback is never called. Calling it a second time returns a session but its no longer active.

Any hints ?

Thanks.

Installed latest, doesn't build

Hi guys,

I actually had this just about working. I was to the point that my app would discover my Chromecast, but when I tried to cast media, nothing would happen. I read on this project that it could be that I didn't have the latest versions of the google-play-services and the latest version of this plugin installed... so I upgraded.

Problem is that since I did the upgrade, I'm getting build errors. They look just like simple fixes. I was wondering if you guys are aware. I'm hoping you could offer some help. Thanks so much!... Here's the errors:

[javac] Compiling 13 source files to c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\ant-build\classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\Chromecast.java:207: error: cannot find symbol
[javac]                 ArrayList<String> seq_tmp1 = new ArrayList<String>();
[javac]                 ^
[javac]   symbol: class ArrayList
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\Chromecast.java:207: error: cannot find symbol
[javac]                 ArrayList<String> seq_tmp1 = new ArrayList<String>();
[javac]                                                  ^
[javac]   symbol: class ArrayList
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\Chromecast.java:209: error: cannot find symbol
[javac]                 final ArrayList<Integer> seq_tmp_cnt_final = new ArrayList<Integer>();
[javac]                       ^
[javac]   symbol: class ArrayList
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\Chromecast.java:209: error: cannot find symbol
[javac]                 final ArrayList<Integer> seq_tmp_cnt_final = new ArrayList<Integer>();
[javac]                                                                  ^
[javac]   symbol: class ArrayList
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\Chromecast.java:470: error: incompatible types: Double cannot be converted to Integer
[javac]             return this.loadMedia (contentId, contentType, duration, streamType, autoPlay, new Double(currentTime.doubleValue()), callbackContext);
[javac]                                                                                            ^
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastSession.java:201: error: method createLoadUrlRequest in class ChromecastMediaController cannot

be applied to given types;
[javac] MediaInfo mediaInfo = chromecastMediaController.createLoadUrlRequest(contentId, contentType, duration, streamType, metadata);
[javac] ^
[javac] required: String,String,long,String
[javac] found: String,String,long,String,JSONObject
[javac] reason: actual and formal argument lists differ in length
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:31: error: cannot find symbol
[javac] int metadataType = metadata.has("metadataType") ? metadata.getInt("metadataType") : MediaMetadata.MEDIA_TYPE_MOVIE;
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:31: error: cannot find symbol
[javac] int metadataType = metadata.has("metadataType") ? metadata.getInt("metadataType") : MediaMetadata.MEDIA_TYPE_MOVIE;
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:36: error: cannot find symbol
[javac] mediaMetadata.putString(MediaMetadata.KEY_TITLE, (metadata.has("title")) ? metadata.getString("title") : "[Title not set]" ); // TODO: What should it default to?
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:36: error: cannot find symbol
[javac] mediaMetadata.putString(MediaMetadata.KEY_TITLE, (metadata.has("title")) ? metadata.getString("title") : "[Title not set]" ); // TODO: What should it default to?
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:37: error: cannot find symbol
[javac] mediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, (metadata.has("title")) ? metadata.getString("subtitle") : "[Subtitle not set]" ); // TODO: What should it defaul
t to?
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:37: error: cannot find symbol
[javac] mediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, (metadata.has("title")) ? metadata.getString("subtitle") : "[Subtitle not set]" ); // TODO: What should it defaul
t to?
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\src\acidhax\cordova\chromecast\ChromecastMediaController.java:38: error: cannot find symbol
[javac] mediaMetadata = addImages(metadata, mediaMetadata);
[javac] ^
[javac] symbol: variable metadata
[javac] location: class ChromecastMediaController
[javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[javac] 13 errors
[javac] 3 warnings

BUILD FAILED
C:\DEVELOPMENT\PHONEGAP\android\sdk\tools\ant\build.xml:720: The following error occurred while executing this line:
C:\DEVELOPMENT\PHONEGAP\android\sdk\tools\ant\build.xml:734: Compile failed; see the compiler error output for details.

Total time: 6 seconds

c:\DEVELOPMENT\PHONEGAP\ZOMBEETV\zombee\platforms\android\cordova\node_modules\q\q.js:126
throw e;

missing enums in JS implementation

I think there are missing enums for chrome.cast.SessionStatus

Those should be used to check for the session status on session update listeners (i.e.

/**
 * Status of this Cast session to the receiver application. Must not be null.
 * @type {!chrome.cast.SessionStatus}
 */
chrome.cast.Session.prototype.status;

Here it is from official documentation for chrome implementation:

/**
 * The session is connected to the receiver application.
 * @type {chrome.cast.SessionStatus}
 */
chrome.cast.SessionStatus.CONNECTED;


/**
 * The session is disconnected from the receiver application. The
 * receiverapplication may or may not still be running.
 * @type {chrome.cast.SessionStatus}
 */
chrome.cast.SessionStatus.DISCONNECTED;


/**
 * The receiver application has been stopped.
 * @type {chrome.cast.SessionStatus}
 */
chrome.cast.SessionStatus.STOPPED;

addMessageListener broken?

I'm having trouble with addMessageListener. The same code on Chrome works perfectly fine, but with this cordova plugin I get nothing. No error messages in adb logcat or the JS console. Just nothing at all.

In the sender app I have this (after creating the session, etc.):

_session.addMessageListener(NAME_SPACE, function(ns, message) {
    console.log('message: ', message);
});

On the receiver app I do this:

customMessageBus.broadcast({msg: 'hello'});

But literally nothing happens. Again, the exact same code with the same namespaces, same method of generating the session, etc., works fine on Chrome.

Unable to install plugin

Hi,
I'm trying to install this plugin in my existing cordova project. My project currently doesn't have play service support. I'm using cordova 7.0.1 on my windows system.
below are the error logs which I get just after running the add plugin command. i.e.
cordova plugin add https://github.com/GetVideostream/cordova-chromecast.git

Error: Failed to fetch plugin https://github.com/GetVideostream/cordova-chromecast.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963228 Error output:
npm ERR! addLocal Could not install C:\Users\shash\AppData\Local\Temp\npm-5956-21293606\git-cache-5bcb71aa\81ebbf80ea2513395ef8d695c0d
b612bd2e36e1a
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\shash\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "ins
tall" "https://github.com/GetVideostream/cordova-chromecast.git" "--save"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

npm ERR! Please include the following file with any support request:
npm ERR! D:\Shashank\Cordova\Gazebo\Gazebo-New\node_modules\npm-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.