We should be able to integrate ChromeCast via Google Cast API. https://developers.google.com/cast/docs/remote
("btpp-fixlater" just to indicate that I don't know your timeline :)
(In reply to Andrew Overholt [:overholt] from comment #1) > ("btpp-fixlater" just to indicate that I don't know your timeline :) Sure no problem! I'm just documenting all the working items and we'll figure out the priority and timeline later.
Hi Jim, I'm working on Chromecast support for Fennec. I can display something remotely on Chromecast already. And now, I want to integrate GeckoView into that.  is my WIP patch. And I found Fennec doesn't support multiple GeckoView currently. Could you give me some suggestions to create multiple GeckoView? Any workaround is fine, I just want to create a rough prototype for that. Thank you! : https://github.com/KuoE0/gecko-dev/commit/6c5c5bd8d7c1492ed85414727022f089d1502848 : https://dxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp#105-107
Hi Tommy, using multiple GeckoViews is possible, but you would need a different chrome XUL document than the default, because Fennec's browser.xul does not support multiple GeckoViews. The chrome XUL URI is set at , so you could add a string parameter to Open() and pass in a different URI for your second GeckoView.  https://mxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp?rev=16663eb3dcfa#1123
Hi Jim, thanks for your help. Now, I can make Chromecast show 'https://www.mozilla.org/en-US/' by using a bad way. And I have some questions about nsWindow and GeckoView: 1. Is GeckoViewSupport::Open is called when a GeckoView is created? So, if I want to create a new nsWindow for Android, I think I don't need to call nsWindowWatcher.openWindow directly. 2. How to pass the parameters to GeckoViewSupport::Open? I think GeckoViewSupport::Open is called here. 3. How does `OnNativeCall` work? Can you give me some hint? Thank you for your help :) : https://dxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp#193-198
(In reply to Tommy Kuo [:KuoE0] from comment #5) > 1. Is GeckoViewSupport::Open is called when a GeckoView is created? So, if I > want to create a new nsWindow for Android, I think I don't need to call > nsWindowWatcher.openWindow directly. Right, when a GeckoView is first created, Android calls GeckoView.onAttachedToWindow, and we create a nsWindow in there through the native call to GeckoViewSupport::Open .  https://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoView.java?rev=829d3be6ba64#232 > 2. How to pass the parameters to GeckoViewSupport::Open? I think > GeckoViewSupport::Open is called here. So to pass a parameter to GeckoViewSupport::Open, you need to add a parameter to GeckoView.Window.open , and add an argument to the calls at . After you change the Java code, you need to build Fennec one time. The build will fail, but in the build output you can see a command you have to run to synchronize the C++ JNI code with the Java code changes. After you run the command, you can change the C++ signature at , and everything should work.  http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoView.java?rev=829d3be6ba64#118  http://mxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp?rev=829d3be6ba64#1108 > 3. How does `OnNativeCall` work? Can you give me some hint? OnNativeCall is called in C++ when a native Java method is called. The Java call arguments are put into a C++ function object that is passed to OnNativeCall. When you call the function object, i.e. aCall();, the Java call arguments are passed to the target C++ functions. I made a diagram to illustrate the sequence .  https://people.mozilla.org/~nchen/img/jni-natives.png
Jim, thank you for the answer!!! It is very helpful!
Hi Jim, I have a problem on the resolution. In `onAttachedToWindow()`, I got 1280x760 for Chromecast. But the page shows the resolution is 360x592. I have no idea about where the numbers come from. Is the reason I open an URL from WindowWatcher.OpenWindow() directly? For now, I have not create another browser.xul for Chromecast. Or maybe there is another reason? My source code is here. Please ignore the commit "add remote_browser.xul", I don't use it yet. Thank you! : https://github.com/KuoE0/gecko-dev/commits/chromecast-on-fennec
Oh, I know what the problem is. On Nexus 5, the physical resolution is 1080 (w) x 1920 (h), but the CSS resolution is 360 (w) x 640 (h). It caused by the pixel ratio (3 on Nexus 5). I think I need to set pixel ratio to 1 for Chromecast!
After some investigation on the wrong resolution, I found the nsDeviceContext we got on Chromecast is wrong. I think we always get the device context of the primary screen. So, I filed bug 1282003 to make nsScreenManagerAndroid support multiple screens like nsScreenManagerGonk.
I think some people are interested in the frame rate on Chromecast devices. I turn on the pref "layers.acceleration.draw-fps" to show the frame rate on the web page. And open the URL "http://www.testufo.com/#test=framerates" to test the frame rate. And I found the maximum fps is about 35.
Curious, what kind of frame rate does Chrome give?
(In reply to Olli Pettay [:smaug] (high review load, please consider other reviewers) from comment #12) > Curious, what kind of frame rate does Chrome give? I have no idea about how to test it on Google Chrome. I don't find any method to render a web page to Chromecast on Google Chrome by Remote Display API. Currently, Google Chrome (desktop) support to mirror a page or cast a video on the Chromecast. And the Android ver. can only cast a video to the Chromecast.
I found the reason why the frame rate is low, because I used the debug build. I retry with release build, and the frame rate is 50 ~ 60.
Attachment #8765790 - Attachment is obsolete: true
Frame test video on Youtube: https://youtu.be/kSijqQLLd-M
(In reply to Tommy Kuo [:KuoE0] from comment #14) > I found the reason why the frame rate is low, because I used the debug > build. Heh :) > I retry with release build, and the frame rate is 50 ~ 60. Great, thanks.
You need to log in before you can comment on or make changes to this bug.