Forum Xamarin.iOS

How to open YouTube link in YouTube app with 'Back to APPLICATION NAME' arrow ?

PreranaPPreranaP USUniversity

Hello All,


I am trying to open an YouTube video from iOS application, using the code below :

    UIApplication.SharedApplication.OpenUrl (new NSUrl ("YouTubeLink"));



It opens the video in YouTube app installed or in Safari if its not preinstalled. Now the issue is when its opening YouTube/Safari app there is no way to go back to my iOS application(prior to iOS 9). In iOS 9, I noticed it maintaining a link which allows users to go back to the application where the call was initiated. Following is the screenshot :

image



Is there any way I can implement the same thing prior to iOS 9 i.e iOS 8 and iOS 7? Any configurations or settings?

Thanks a ton in advance!


-Prerana

Best Answer

  • rmaciasrmacias USBeta, University ✭✭✭✭✭
    Accepted Answer

    Apple introduced that feature in iOS 9. There is no backwards compatibility with iOS 8 and below.

Answers

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭
    edited March 2016

    For iOS it should be youtube://watch?v=<video id> without the < and > characters

  • PreranaPPreranaP USUniversity

    @GeraldVersluis , thanks for the response. I used it the way you suggested but in this (youtube://watch?v=) case if the phone doesn't have the Youtube app installed it won't fallback on Safari whereas if I use (https://www.youtube.com//watch?v=) it will fallback on Safari. The main concern still being going back to my iOS app :(

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    As far as I know, from iOS 9 if an app opens any other app by a link (web or deep link) the 'Back to ...' button should be visible!

  • PreranaPPreranaP USUniversity

    Exactly its visible in iOS 9 but not in iOS 8/ iOS 7, is there any workaround for previous iOS versions or any other way I should implement it apart from opening it in YouTube/Safari app ?

  • rmaciasrmacias USBeta, University ✭✭✭✭✭
    Accepted Answer

    Apple introduced that feature in iOS 9. There is no backwards compatibility with iOS 8 and below.

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    @PreranaP said:
    Exactly its visible in iOS 9 but not in iOS 8/ iOS 7, is there any workaround for previous iOS versions or any other way I should implement it apart from opening it in YouTube/Safari app ?

    Ah now I understand your question, unfortunately as @rmacias points out, there is no way to enable this functionality in older versions.

  • PreranaPPreranaP USUniversity

    Hmmm, so that leaves me with no other option but to embed the video inside the app in web view using iframe. Thanks a ton @GeraldVersluis , @rmacias for the response :) Have a great day! Happy coding :)

Sign In or Register to comment.