View Single Post
Ivan_hl2dm
New Member
Join Date: Nov 2018
Old 12-02-2018 , 06:19   Re: [ANY] SoundCloud ( v1.7.3 Updated 7/10/2017 )
Reply With Quote #126

Quote:
Originally Posted by Alienmario View Post
I've tried that, didn't work in game. Did you test in-game?
Yes it`s work. But:

Need to enter !scopen and click once on play.
after that it will start automatically

I rewrote the soundcloud.php a bit.
Maybe this will help.
PHP Code:
<script type="text/javascript">
    function whenAvailable(name, callback) {
    var interval = 1000; // ms
    window.setTimeout(function() {
        if (window[name]) {
            callback(window[name]);
        } else {
            window.setTimeout(arguments.callee, interval);
        }
    }, interval);
}

whenAvailable("widget", function(t) {

    setTimeout(function () {
            //Check if the current URL contains '#'
            if(document.URL.indexOf("#")==-1){
                // Set the URL to whatever it was plus "#".
                url = document.URL+"#";
                location = "#";

                //Reload the page
                location.reload(true);
                // window.location.href= "https://www.youtube.com/watch?v=iFYVYDxUDqA"; // the redirect goes here
            }

    },1000);

    widget.setVolume(<?php echo $volume;?>);
        widget.bind(SC.Widget.Events.PLAY_PROGRESS, function() {
        widget.seekTo(<?php echo $seek;?>);
        widget.getPosition(function(position) {
            if(position == <?php echo $seek;?>){
                widget.unbind(SC.Widget.Events.PLAY_PROGRESS);
            }
        });
    });
    //alert("It's loaded!");

});
</script>

<script type="text/javascript">
//window.onload = function () { alert("It's loaded!") };

    var widget = SC.Widget(document.querySelector("iframe"));

    widget.bind(SC.Widget.Events.READY, function() {
        widget.setVolume(<?php echo $volume;?>);
    });
    console.log(widget);
    widget.bind(SC.Widget.Events.PLAY_PROGRESS, function() {
        widget.seekTo(<?php echo $seek;?>);
        widget.getPosition(function(position) {
            if(position == <?php echo $seek;?>){
                widget.unbind(SC.Widget.Events.PLAY_PROGRESS);
            }
        });
    });

var iframe = document.querySelector("iframe");


</script>
Ivan_hl2dm is offline