Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 4 of 6 FirstFirst ... 23456 LastLast
Results 46 to 60 of 78

Thread: on-air script

  1. #46
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    Ahhh...my apologies.

    Okay, but that's not in the same directory, then, as the other images.

    We *can* use images from other directories, but it would be MUCH MUCH easier if you'd put them all into the same directory.

    The other images you showed are in the directory
    http://www.destiny106.co.uk/djonair/

    Also, the image at
    http://www.destiny106.co.uk/djonair/jay.jpg
    is completely different than the image at
    http://www.destiny106.co.uk/pics/jay.jpg

    So now I don't even know which you really want.

    *PLEASE*, just to make sure, put *ALL* images into the "djonair" directory.

  2. #47
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    By the by, except for images for John and Lacuda (and the wrong location for JML.jpg) and except for not having the schedule for John and Lacuda, I have it working.

    Fix the images, give me more info, and I'll show it to you.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  3. #48
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    By the by, except for images for John and Lacuda (and the wrong location for JML.jpg) and except for not having the schedule for John and Lacuda, I have it working.

    Fix the images, give me more info, and I'll show it to you.
    ok the JML.jpg is in the djonair section the images i gave you i want to
    use are the ones in djonair

  4. #49
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    Okay...try this.

    Remember, this must be a PHP page for it to work.

    It gets the SERVER time from PHP code and then keeps adjusting the time it gets from the client's computer to match the true server time. It checks every 30 seconds if the display needs updating.

    Code:
    <!DOCTYPE html>
    <html>
    <head></head>
    <body>
    <div>
        ... other page content goes here ...
    
        <p align="center"><img id="DJImage" src="http://www.destiny106.co.uk/djonair/autodj.gif" /></p>
    
        ... other page content goes here ...
    
    </div>
    <!-- the script goes *JUST BEFORE* the /body tag -->
    <script type="text/javascript">
    (
      function( ) /* anonymous master function */
      {
          // chart of DJ times...easy to modify
          // each day, you create an array of arrays
          // each element of the INNER array has three fields:
          //     0 -- "short" name of the DJ or DJs.
          //     1 -- start time of the segment for that DJ
          //     2 -- end time of the segment for that DJ
          var schedule = {
              "SUN" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ],
              "MON" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ],
              "TUE" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ],
              "WED" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ],
              "THU" : [ 
                        [ "bothRU", 2200, 2329 ], /* RU == Rabbit + Ultra */
                        [ "rabbit", 2330, 2359 ] 
                      ],
              "FRI" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ],
              "SAT" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ]
          }
          // days of the week as 3 char strings:
          var weekdays = ["SUN","MON","TUE","WED","THU","FRI","SAT"];
    
          // here is the mapping from short names to image names
          // you can add short names as you wish and when you do, 
          // the name after the colon has to be the IMAGE name for that DJ
          var images = {
              "auto"   : "autodj.gif",
              "ultra"  : "jay.jpg",
              "bothRU" : "djpic.jpg",
              "rabbit" : "JML.jpg",
              "john"   : "BADNAME.jpg",
              "lacudo" : "BADNAME.jpg"
          };
    
    
          // get the server side date and time into JavaScript:
    <?php
          echo "var serverTime = new Date(" . date("Y,m,j,G,i,s") . ");";
    
    ?>
    
          // adjust that to JS time (months start at zero in JS)
          serverTime.setMonth( serverTime.getMonth() - 1);
    
          // now get current browser date and time:
          var clientTime = new Date();
    
          // get the offset:
          var offset = serverTime.getTime() - clientTime.getTime();
    
    
          // then here is the function that sets the images in place:
          function setImage( )
          {
              // current client time
              var now = new Date();
              // adjust that to get current server time:
              now.setTime( now.getTime() + offset );
    
              // and then follow the rules given:
              // remember: now is adjusted to GMT now
              var wkday = weekdays[ now.getDay() ];
              var MMSS  = now.getHours() * 100 + now.getMinutes(); 
    
              var dj = "auto"; // this is assumed if none of the other conditions apply
              // see if there is a match in schedule for current day and time
              var times = schedule[wkday];
              for ( var t = 0; t < times.length; ++t )
              {
                  var tcheck = times[t];
                  if ( tcheck[1] <= MMSS && MMSS <= tcheck[2] )
                  {
                      dj = tcheck[0];
                      break; // out of for loop
                  }
              }
              // get the image file name based on dj name
              var imageURL = "http://www.destiny106.co.uk/djonair/" + images[dj];
              // and change the displayed image:
              document.getElementById("DJImage").src = imageURL;
    
              // and do this again in, say, 30 seconds:
              setTimeout( setImage, 30000 );
    
          } // end of setImage function
    
          setImage( ); // invoke it once to get started
    
      } // end of anonymous master function
    )(); // self-invoke anonymous function
    </script>
    </body>
    </html>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  5. #50
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    If you want to test it out right now, and right now is not between 2200 and 2359, you could *TEMPORARILY* add an entry to the schedule.

    For example, suppose you see this on Sunday, and it is 1:20PM, and you want to test it out.

    Okay just modify the SUNday schedule to add in a new schedule time:
    Code:
              "SUN" : [ 
                        [ "ultra", 1300, 1659 ],  /* 1PM to 5PM say */
                        [ "rabbit", 2200, 2359 ] 
                      ],
    And then your "jay.jpg" image should appear until 5PM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  6. #51
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok does this part

    "SUN" : [
    [ "ultra", 1300, 1659 ], /* 1PM to 5PM say */
    [ "rabbit", 2200, 2359 ]
    ],


    go at the bottom on the code

  7. #52
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    Quote Originally Posted by djultra View Post
    ok does this part

    "SUN" : [
    [ "ultra", 1300, 1659 ], /* 1PM to 5PM say */
    [ "rabbit", 2200, 2359 ]
    ],


    go at the bottom on the code
    NO NO NO NO!!!

    It simply REPLACES (and again temporarily, just for testing) the original schedule for SUNday.

    That is, it replaces
    Code:
              "SUN" : [ 
                        [ "rabbit", 2200, 2359 ] 
                      ],
    But by the time you read this and work with it, it will be long past 5PM SUNday in the UK, so you will need to use some other change to the schedule to test it out.

    Or don't change it. Just leave it alone and watch it work from 10PM to midnight each day.

    You really don't understand coding, especially JavaScript coding, at all, do you? I'm worried that you don't understand at all how my code works and how you could modify it when the schedule changes. You might want to get some of your partners to look at this with you and hope that between all of you that you can make sense of it.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  8. #53
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is it possible if the code you gave me can use a stream as well
    when each dj goes live on the air. so that it changes to there image through
    a sertain stream

  9. #54
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    I don't understand that, at all. What does an image have to do with a stream?

    Can you show the code that is getting or creating the stream now, if there is one?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  10. #55
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i don't have one no lol but is there such code that changes the images with a stream

  11. #56
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    If I know HOW the stream was being changed, then probably yes.

    But if you can't tell me how the stream is changed, then I haven't a clue.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  12. #57
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ooooh ok ta

  13. #58
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah i know but im looking for a php code were the stream handles the images as well for wen every dj goes on air at different times
    106themix has a djcenter were you login to it then you upload you're image when you're just about
    to go on air. but im looking for a code were it changes images with the stream? say shoutcast or icecast

    shoutcast would do

  14. #59
    New Coder
    Join Date
    Mar 2013
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts
    see something like this code but its coded for joomla and i dont want a joomla code
    i would like a different for that i can stick my stream in and times and days and dj images
    abit like the code old pendant gave me but with a stream in


    PHP Code:
    [QUOTE]<div class="well ">

    <
    style type="text/css">
    <!--

    .
    clear clearboth; }



    -->
    </
    style>


        
        <
    script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript" src="/joomlademos/modules/mod_kessefdjdisplay/js/mediaelement-and-player.min.js"></script> 
        <link rel="stylesheet" href="/joomlademos/modules/mod_kessefdjdisplay/css/style.css" type="text/css" media="screen">
        
        
        
        
        <script>
            $(document).ready(function() {            
                
            $('#audio-player').mediaelementplayer({
                    alwaysShowControls: true,
                    features: ['playpause','volume','autoplay','audioplay'],
                    audioVolume: '',
                    audioplay: 'true',
                    autoplay: 'true',
                    audioWidth: 100,
                    audioHeight: 1
        
                
                });
            });
        </script>
        
        
        
        
        





    <table border="0" height="140px" cellspacing="0px" cellpadding="0px" width="180px" style="margin:0px;border:0;"><tbody><tr><td><div class="audio-player" style="height:140px;background-color:#000000;width:180px"><div id="mep_0" class="mejs-container mejs-audio" style="width: 100px; height: 1px;"><div class="mejs-inner"><div class="mejs-mediaelement"><audio id="audio-player" src="http://173.224.124.211:8004/;" type="audio/mp3" autoplay="autoplay"></audio></div><div class="mejs-layers"><div class="mejs-poster mejs-layer" style="display: none; width: 100px; height: 1px;"></div></div><div class="mejs-controls"><div class="mejs-button mejs-playpause-button mejs-pause"><button type="button" aria-controls="mep_0" title="Play/Pause"></button></div><div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="mep_0" title="Mute Toggle"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current" style="width: 80px;"></div><div class="mejs-volume-handle" style="left: 30px;"></div></div></div></div><div class="mejs-clear"></div></div></div><img class="cover" src="/joomlademos/images/dj.jpg" border="0" width="65px" height="68px"><div style="color:#0FFFFF;margin-top:5px;margin-left:78px;font-size:10px;"><b>ON AIR</b><br>12 às 22hs<div class="clear"></div></div><div style="color:#FFFFFF;font-size:11px;margin-right:4px;margin-left:78px;margin-top:-37px">Dj Kessef<br>Top Rock Show<div class="clear"></div></div><br><div style="margin-right:2px;;margin-left:77px;"><a href="http://www.kessefbrasil.com/marketingonline/index.php?Itemid=80&amp;option=com_breezingforms&amp;view=form" target="_blank"><img src="/joomlademos/modules/mod_kessefdjdisplay/img/request.png" border="0"></a><div class="clear"></div></div></div></td></tr></tbody></table>

    </div>[/QUOTE] 
    Last edited by djultra; 03-26-2013 at 03:11 AM.

  15. #60
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,458
    Thanks
    76
    Thanked 4,373 Times in 4,338 Posts
    The only part of that code that specifies where the audio is coming from is here:
    Code:
    <audio id="audio-player" src="http://173.224.124.211:8004/;" type="audio/mp3" autoplay="autoplay"></audio>
    But there is *NOTHING* there for "changing" the stream.

    It's just one stream, from one URL.

    So if the stream is changed, it must be change at that other URL, and there would be no way of detecting that from the browser.

    *IF* the URL changed, that we could detect. But that doesn't seem to happen.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


 
Page 4 of 6 FirstFirst ... 23456 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •