No announcement yet.

Streaming Radio Stations disconnects - Any way to resume stream playback

  • Filter
  • Time
  • Show
Clear All
new posts

  • Streaming Radio Stations disconnects - Any way to resume stream playback

    I built a small radio app a while back thanks to a lot of peoples help here

    I have run into a small problem, every none and then the stream stops (small drops on network causing it) and i have to click the play button again to resume the playback.

    To play my stream is just a simple push button action that calls a specific .m3u file depending on the radio station.
    -- Load TodayFM M3U
    MediaPlayer.Load("Plugin1", "AutoPlay\\Audio\\td4.m3u");
    -- Play the M3U File

    Is there any code i can implement that would resume the stream if it disconnects and would always do this unless the stop button is pressed.

    Any help much appreciated (If you need the full app source code let me know)

  • #2

    I suggest another way ...... try VLC (with reteset's ActiveX plugin)
    as soon as I have time, I'll give you an example


    • #3

      rework of an old project

      try it with your channel list ..................
      if you want to use the fading function, remove the custom skin

      17mb *******


      • #4
        Originally posted by PurpleRose View Post
        Is there any code i can implement that would resume the stream if it disconnects and would always do this unless the stop button is pressed.
        A definitive solution is difficult without the complete context in which your problem exists. And is therefore why it's important to supply the project.apz (or a close mockup of it) for these types of queries.

        However, based on the description you have given, the following should fix the problem:

        Place this code on the page's On Timer event...
        if (MediaPlayer.GetState("Plugin1") == VIDEO_STOPPED) then
        and this at the top of your Page On Show event...
        Page.StartTimer(1000, 10); -- adjust timer speed according to needs.
        Failing that, upload the project.apz so we can take a closer look.


        • #5
          I have attached the .apz.

          I am not 100% sure with your advice Bio as i already have a timer and since i don't know enough to about coding to know what i should do.
          Any help or advice is much appreciated.

          Attached Files


          • #6
            Thanks Herrin for the help, i would perfer and try and stick with what i have done so far, but will try and learn some new stuff from your apz


            • #7
              While testing this under Win7 in both preview and compiled mode, I can not replicate the issue described. I see no evidence of the stream dropping which suggests it may be a local issue with your network. And although there are significant issues with your design approach (and with the code) neither of these are likely responsible for any interruptions you may be experiencing with the stream. At least not that I can see.

              I would however make some suggestions:

              Firstly, the design approach you've taken here creates an enormous and unnecessary overhead that's quite punishing on system resources. 17 pages? Really? You could (and should) be using just one page. Look in your System Processes at what's happening each time you navigate successive pages:

              Here we are at intial runtime, using just 31K of memory ...

              But look what happens by the time the user's clicked through all 17 pages/streams ...

              Yikes! At 616K it's chewing up about 20x the memory initially being used.
              LOL, time to run for the hills wouldn't you say?

              It'd be much more efficient to use a single page from which you can load each stream, logo, text, etc. Same rules of efficiency should be applied to the code, too. Instead of all the unnecessary repetition, define your data as a set of behaviors and functions in Globals. And then call it up as necessary - from a single set of navigation buttons on your main page. There's a number of approaches you can take with that.

              Use your imagination. Hahah, like Mr Rogers says, just look in the garden of your mind - you can plant stuff there and watch it grow.

              Here's one approach you could take ...

              This example demonstrates with just 5 of your 17 streams. But you could add another 1000 and it'll still use less than 20K of memory. Same outcome as with your design - but done via a single page and with just a fraction of the code. No need for all the repetition.

              And keep in mind that you're streaming here. So you will experience small delays while the plugin goes online to load its remote connections. No getting around that. But if you're still experiencing dropped streams, then it's most likely a local issue.
              Attached Files


              • #8

                LOL, after all that I nearly forgot your original query about applying the timer code. Haha - the absent minded professor, right?

                Okay, so on the assumption that any stream dropouts you're experiencing are indeed an issue with your network and nothing to with the app itself, then adding the suggested timer code is the only thing that will guard against the problem.

                You already have the Page.StartTimer() command in the On Show events for each page but ensure this command is coded correctly. Lke this:
                Page.StartTimer(1000, 10);
                The fist number (1000) means the timer will fire every 1000 milliseconds. The second number (10) is the ID number assigned to the Timer. At the moment you have it coded to fire every 151 millisecs. Slow it down a bit, it probably doesn't need to be that fast. Try setting it to 200 or 500. (Or whatever seems to work best).

                And the rest of the code ...
                if (MediaPlayer.GetState("Plugin1") == VIDEO_STOPPED) then
                ... then goes in the Timer event itself (together with the other stuff you have in there). Keep in mind that although only one timer can be used on any given page, multiple actions can be assigned to that timer. So it matters not that you're already using one.

                But before you proceed, my strong recommendation would be to rethink your approach and get rid of all those unnecessary pages.