Progress Bar help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TimeSurfer
    Forum Member
    • Dec 2007
    • 479

    Progress Bar help

    I seem to be having a wierd problem with my progress bar or maybe its my code but watever it is its not working correctly. im having to load like 2-3 different media files before the progress bar will even start to work.

    heres the code from all 3 events that deal with both the progress bar and the label i have set as a timer for the media which shows the time of the media using the datediff plugin to format it to 00:00:00 for video and 00:00 for music. the label timer counts backwards from the length of the media to 0

    i have highlighted the code i added for the progress bar in blue since that is the piece that isnt working. the label however works fine except when i pause and resume the playback it reset the label to the length of the media for just a second then resumes where it left off.
  • TimeSurfer
    Forum Member
    • Dec 2007
    • 479

    #2
    page on timer code:

    Code:
    mtpos = MediaPlayer.GetCurrentPos("Plugin1");
    mtime = mtlen - mtpos
    mtime = DateDiff.FormatSeconds(mtime);
    mft = String.Find(mediafile[1], ".mp3", 1, false);
    if (mft == -1) then
      Label.SetText("Label1", mtime);
      [COLOR="blue"]Progress.SetCurrentPos("Progress1", mtpos);[/COLOR]
     else
      mtime = String.Right(mtime, 5);
      Label.SetText("Label1", mtime);
      [COLOR="Blue"]Progress.SetCurrentPos("Progress1", mtpos);[/COLOR]
    end

    Comment

    • TimeSurfer
      Forum Member
      • Dec 2007
      • 479

      #3
      mediaplayer object on play code:

      Code:
      mtlen = MediaPlayer.GetLength("Plugin1");
      if (mtlen ~= mtdiff) then
      mtl = mtlen - 0
      mtime = DateDiff.FormatSeconds(mtl);
      mft = String.Find(mediafile[1], ".mp3", 1, false);
      if (mft == -1) then
        Label.SetText("Label1", mtime);
        Page.StartTimer(1000);
      else
        mtime = String.Right(mtime, 5);
        Label.SetText("Label1", mtime);
        Page.StartTimer(1000);
      end
      else
      mft = String.Find(mediafile[1], ".mp3", 1, false);
      mtime = DateDiff.FormatSeconds(mtimed);
      if (mft == -1) then
        Label.SetText("Label1", mtime);
        Page.StartTimer(1000);
      else
        mtime = String.Right(mtime, 5);
        Label.SetText("Label1", mtime);
        Page.StartTimer(1000);
      end
      end

      Comment

      • TimeSurfer
        Forum Member
        • Dec 2007
        • 479

        #4
        media load button on click code:

        [CODE]mediafile = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Media Files|*.mp3;*.wmv;*.wma;*.mpeg;*.mpg;*.asf;*.avi|M P3 Media (*.mp3)|*.mp3|Movie Files (*.mpeg,*.mpg)|*.mpeg;*.mpg|Windows Media Files (*.wma,*.wmv)|*.wma;*.wmv|Windows Audio/Video Files (*.asf,*.avi)|*.asf;*.avi|", "", ".mp3", false, false);
        MediaPlayer.Load("Plugin1", mediafile[1]);
        Label.SetVisible("Label1", true);
        mtlen = MediaPlayer.GetLength("Plugin1");
        Progress.SetRange("Progress1", 0, mtlen);
        Progress.SetStep("Progress1", 1);

        mtime = DateDiff.FormatSeconds(mtlen);
        mft = String.Find(mediafile[1], ".mp3", 1, false);

        Comment

        • TimeSurfer
          Forum Member
          • Dec 2007
          • 479

          #5
          media load button code continued

          Code:
          if (mft == -1) then
            tbmedfn = String.SplitPath(mediafile[1]);
            Paragraph.SetText("Paragraph1", tbmedfn.Filename);
            Paragraph.SetVisible("Paragraph1", true);
            Label.SetText("Label1", mtime);
            Page.StartTimer(1000);
          else
            mtime = String.Right(mtime, 5);
            Label.SetText("Label1", mtime);

          Comment

          • TimeSurfer
            Forum Member
            • Dec 2007
            • 479

            #6
            Code:
              sTitle = DLL.CallFunction("AutoPlay\\Docs\\GetTagInfo.dll", "GetTagInfo", "\""..mediafile[1].."\",1", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
              sArtist = DLL.CallFunction("AutoPlay\\Docs\\GetTagInfo.dll", "GetTagInfo", "\""..mediafile[1].."\",2", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
              Paragraph.SetText("Paragraph1", sTitle);
              Paragraph.SetVisible("Paragraph1", true);
              Paragraph.SetText("Paragraph2", "Artist: " ..sArtist);
              Paragraph.SetVisible("Paragraph2", true);
              Page.StartTimer(1000);
            end
            [/CODE]

            Comment

            • TimeSurfer
              Forum Member
              • Dec 2007
              • 479

              #7
              media pause button code:

              Code:
              MediaPlayer.Pause("Plugin1");
              Page.StopTimer();
              media play/resume button code:

              Code:
              MediaPlayer.Play("Plugin1");
              Page.StartTimer(1000);
              sorry for the multiple reply's in this thread my internet is being gay and is only allowing me to send so much data at a time.

              Comment

              Working...
              X