Zeldarck

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Back Button In front of page #295
    Zeldarck
    Participant

    So it’s work 🙂

    in reply to: Back Button In front of page #294
    Zeldarck
    Participant

    Ok I am idiot, I forgot to c/c the code of this function from your read me, I will try with, sorry ><

    in reply to: Back Button In front of page #292
    Zeldarck
    Participant

    So, the message is effectivily send with

    function sendMessageToUnity(message) {
    if (isIOS()) {
    appendIframeWithURL('inappbrowserbridge://' + message);
    } else if (isAndroid()){
    UnityInAppBrowser.sendMessageFromJS(message);
    }
    }

    but my callback is not call:

     
            bridge.onJSCallback.AddListener((string s) => OnCloseBrowser());
    
       public void OnCloseBrowser()
        {
            StartCoroutine(CloseYouTubeVideo());       
        }
    
    
    in reply to: Back Button In front of page #291
    Zeldarck
    Participant

    I will begin the debug, but this code didn’t work on IOS (but very well in android)

    in reply to: Screen.Orientation IPhone #290
    Zeldarck
    Participant

    Hi, thank you, yes it work well 🙂
    I didn’t test to set shouldStickToPortrait and shouldStickToLandscape to true both.
    On android it’s ok with orientation in unity

    in reply to: Back Button In front of page #268
    Zeldarck
    Participant

    Ok, I have do that :

    <script>
    
    var userAgent = navigator.userAgent || navigator.vendor || window.opera;
    function isIOS() {
    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
    return true;
    } else {
    return false;
    }
    }
    function isAndroid() {
    return (/android/i.test(userAgent));
    }
    In
    
    function sendMessageToUnity(message) {
    if (isIOS()) {
    appendIframeWithURL('inappbrowserbridge://' + message);
    } else if (isAndroid()){
    UnityInAppBrowser.sendMessageFromJS(message);
    }
    }
    </script>
    
    <div style='position:absolute;left:0;right:0;top:0px;bottom:0;overflow:auto;'>
    <button type="button" onclick="sendMessageToUnity('message')"  style = "        
      border-radius: 8px; border: none;    padding: 0em 1em;
    
        color: white;
        font-size: 16px;position: absolute;top: 10px;left: 10px;background-color: #000000;height: 30px;">X</button>
    
    <iframe id="ytplayer" type="text/html" width="640" height="360"
      src="http://www.youtube.com/embed/kQye2uNafk0?autoplay=1&controls=0&rel=0&showinfo=0&cc_load_policy=1&hl=ru&fs=1"
      frameborder="0" style="margin:0px;padding:0px;"/>
    </div>
    
    void Start(){
            InAppBrowserBridge bridge = FindObjectOfType<InAppBrowserBridge>();
            bridge.onJSCallback.AddListener((string s) => OnCloseBrowser());
    }
    
        public void OnCloseBrowser()
        {
            StartCoroutine(CloseYouTubeVideo());       
        }
    
        protected IEnumerator CloseYouTubeVideo()
        {
            InAppBrowser.CloseBrowser();
            Screen.orientation = ScreenOrientation.Portrait;
            while (Screen.currentResolution.height > Screen.currentResolution.width)
            {
                yield return null;
            }
    
            UICommander.ShowAll();
    
        }
    
        protected IEnumerator PlayYoutubeVideo()
        {
            yield return new WaitForSeconds(1);
    
            UICommander.HideAll();
    
            Screen.orientation = ScreenOrientation.Landscape;
            while (Screen.currentResolution.height > Screen.currentResolution.width)
            {
                yield return null;
            }
    
            InAppBrowser.DisplayOptions displayOption = new InAppBrowser.DisplayOptions();
            displayOption.displayURLAsPageTitle = false;
            displayOption.hidesTopBar = true;
    
            InAppBrowser.OpenLocalFile("test.html", displayOption);
        }
    

    still not very beautiful, if you have a better mean, I’m open to 🙂

    • This reply was modified 4 years, 6 months ago by Zeldarck.
    in reply to: Website video working on iOS device but not Android #263
    Zeldarck
    Participant

    I got the same problem with youtube video, this post help me, thank! 🙂

Viewing 7 posts - 1 through 7 (of 7 total)