0

From the source code of rc_11(11.80927), it does has a interface Application::SetStartLink to set the start URL, but the param has not been used at all, there is no way to change the url when switching from preloading state to kStateStarted for some special cases(eg. add url pairing parameters for dial):

    //there doesn't use the link param(url) in StartApplication in cobalt/browser/main.cc
    void StartApplication(int /*argc*/, char** /*argv*/, const char* /*link*/,
                          const base::Closure& quit_closure) {
      if (!g_application) {
        g_application = new cobalt::browser::Application(quit_closure,
                                                         false /*should_preload*/);
        DCHECK(g_application);
      } else {
        g_application->Start(); -->does NOT use the url param
      }
    }
bitchainer
  • 535
  • 2
  • 19

2 Answers2

0

The URL and initial deep link can only be set at preload time. This is because Preloading is essentially like normal loading, so changing the URL would invalidate the loading that has been done, and would require loading the new URL. Changing the initial deep link also would invalidate the assumption that the initial deep link won't change.

Once loaded, you can dispatch a kSbEventTypeLink at any time. This will not change the URL but will send a message to the running HTML application without causing a reload.

David Ghandehari
  • 534
  • 3
  • 12
  • hi, david, so kSbEventTypeLink can make the newly added param which is appending the youtube url work after preloading cobalt? – bitchainer Aug 08 '17 at 02:16
  • When additionalDataUrl is passed into the YouTube application, doesn't the application send the pairing code to the DIAL server for DIAL Smooth Pairing? Then, the phone application gets the pairing code directly from the DIAL server, and can directly connect to the application. If my understanding is correct, you shouldn't need to send a link or change the URL to accomplish this. – David Ghandehari Aug 08 '17 at 02:59
  • hi, david, as the dial need to add the launch mode param(eg. launch=menu/launch=remote...) to the end of youtube url, and preoloaded cobalt can not change url, so how can we set this param to youtube? – bitchainer Aug 10 '17 at 05:52
  • I see. You can add launch= as a parameter to any deep link, but application state changes are no longer deep links. I'll have to look into this particular case. – David Ghandehari Aug 10 '17 at 06:21
  • There is also another issue when preload function, it can not change to load the test url eg http://qual-e.appspot.com/, so can not open the test url. – bitchainer Aug 15 '17 at 05:24
  • For launch= parameters, please fire a deep link after the transition with the contents, in the example of launching from a menu: `?launch=menu` – David Ghandehari Aug 29 '17 at 02:06
  • When preloading, you can only preload a specific URL that you want to run. We do not support preloading without navigation. If you want to run a different URL than what you preloaded, you should close Cobalt and relaunch with a different `--url=` parameter. – David Ghandehari Aug 29 '17 at 02:10
  • hi david, so do you mean if we add the params eg '?launch=menu' by fire a deep link event, it can send the params to the web page? Does javascript in the webpage would receive a deep link event? If so, what's is the event? – bitchainer Aug 31 '17 at 00:37
  • hi david, if we add the params eg '?launch=menu' by fire a deep link event, how to check whether it works? – bitchainer Aug 31 '17 at 02:28
  • Yeah it will generate a deep link event, h5vcc.runtime.ondeeplink I think. I think Cobalt has a deep link test page that sends links to console.log(). – David Ghandehari Aug 31 '17 at 02:59
  • hi, david, about the value of the kSbEventTypeLink, does youtube need the full url string eg(https://www.youtube.com?launch=menu) or just the param string("launch=menu"?) – bitchainer Aug 31 '17 at 06:50
  • It should be exactly like `?launch=menu` -- a query string with the question mark. – David Ghandehari Aug 31 '17 at 07:34
  • hi, david, following your illustration, the pair code works, thank you! – bitchainer Sep 04 '17 at 01:57
  • hi, david, we need to support youtube tv & youtube kids with cobalt, but it can not change URL with preload mode, so how can we support these 2 apps? Do we need to start an another cobalt process to support it? – bitchainer Sep 07 '17 at 05:51
  • If you want them both preloaded, you would have to run 2 instances of Cobalt, one for each application you want preloaded. Otherwise you could preload one app, and then shut it down when the user launches the other one. – David Ghandehari Sep 07 '17 at 05:54
0
Yes, the additionalDataUrl can be fixed before preload time.
But we need add pairingCode when DIAL cast from DIAL client. 
1> User cast a video from YouTube mobile client.
1> YouTube client will send a POST method to Launch Cobalt through DIALserver with pairingCode. ex. pairingCode=08f5b46d-f027-4ce5-82dc-aae8d7ff97ea&theme=cl
2> We should add the pairingCode as param in URL.
3> TV YouTube based on Cobalt will auto playback the cast video.
It also used to WOL/WOW cases.
So, we can add pairingCode without preload function but for preload mode. How can we handle this case? Is there new way to do it for Cobalt preload function?
bitchainer
  • 535
  • 2
  • 19