Dynamic rich media component for ASP.Net Flash, Video, Audio, FlashVideo and ToolTip / Balloon Help controls for C# and VB.Net
Welcome Guest Search | Active Topics | Members | Log In | Register

SetPosition Issue Options · View
BadPockets
Posted: Friday, April 30, 2010 5:24:19 PM
Rank: Newbie
Groups: Member

Joined: 4/30/2010
Posts: 6
Points: 18
Location: USA
I have downloaded the ASPNetFlashVideo and am playing around with it in order to determine if it will fit my development needs, but seem to have an issue with the SetPostion() javascript call. I don't know if I am doing this correctly, so bear with me as I am still learning the odds and ends of the control.

Basically, I have several images that I am listing as "slides." Each of these has a click event that will move the video to the correct point in time. However, the SetPosition function jumps the FLV video to another point that is towards the end of the video. Here is the sample code:

Code:
<ASPNetFlashVideo:FlashVideo ID="objMovie" runat="server" AllowFullScreen="true" AutoPlay="true" Width="450" Height="450" EolasFixEnabled="true" BufferTime="5" VideoURL="~/videos/sample.flv" StartUpImageURL="startingSlide.JPG" ScaleMode="StretchToFit" ShowControlPanel="true" DebugMode="false"></ASPNetFlashVideo:FlashVideo>
<br />
<br />
<table style="text-align: center;">
     <tr align="center">
          <td>
               <img id="slide1" src="~/images/slide1.JPG" onclick="shiftSlide('1')" />
          </td>
          <td>
               <img id="slide2" src="~/images/slide2.JPG" onclick="shiftSlide('2')" />
          </td>
          <td>
               <img id="slide3" src="~/images/slide3.JPG" onclick="shiftSlide('3')" />
          </td>
          <td>
               <img id="slide4" src="~/images/slide4.JPG" onclick="shiftSlide(4')" />
          </td>
    </tr>
</table>

<script type="text/javascript" language="javascript">
        var movie = ASPNetMedia.FlashVideo("objMovie");
        mark_time = new Array();


        mark_time[1] = 0;
        mark_time[2] = 16;
        mark_time[3] = 37;
        mark_time[4] = 49;
        mark_time[5] = 1256;

        movie.OnPlay = function (object, position) {
            setTimeout('checkTime(' + position + ');', 1000);
            allowSlideShift = 1;
        }

        function checkTime(position) {
            var currSlide = 0;
            for (counter = 1; counter < 5; counter++) {
                if ((position >= mark_time[counter]) && (position < mark_time[counter + 1])) {
                    currSlide = counter;
                }
            }

            if (currSlide != 4) {
                var newPosition = movie.GetPosition();
                setTimeout('checkTime(' + newPosition + ');', 1000);
            }
        }
        function shiftSlide(id) {
            if (id > 0 && allowSlideShift > 0) {
                setPosition(mark_time[id]);           
            }
        }

        function setPosition(pos) {
            movie.SetPosition(pos);
        }
</script>

To recap, shiftSlide gets the second where I would like to move the FLV video to that particluar second. However, setPostion does not go to the indicated second but rather a point in time that is towards the end of the FLV.

Any help is greatly appreciated.
Jake
Posted: Saturday, May 01, 2010 12:59:13 PM
Rank: Administration
Groups: Administration

Joined: 7/26/2007
Posts: 676
Points: 1,728
Location: USA
Try this:

Code:


function setPosition(pos) {
    alert("desired position = "+pos)      ;
  movie.SetPosition(pos);
    alert("gurrent position = "+  movie.GetPosition())      ;
        }


does that shed some light??

Is the movie buffered and loaded appropriately?
Are the positions you are sending in accurate?

http://www.aspnetmedia.com
BadPockets
Posted: Monday, May 03, 2010 2:30:15 PM
Rank: Newbie
Groups: Member

Joined: 4/30/2010
Posts: 6
Points: 18
Location: USA
Jake,

Thank you for your response, but that does not seem to help. To further complicate things, the two alert boxes on the setPostion function show the same information I was getting before. For example, when clicking on slide one, I would get a "desired postion" of 16 but a current position of roughly 167 once the movie.setPosition(pos) line is executed. The video is fully buffered (as I added another alert message on the OnReady event to ensure when the video is fully buffered). Does it change things if the FLV file is hosted locally on my web server?

Thanks,
BP
BadPockets
Posted: Wednesday, June 02, 2010 6:35:53 PM
Rank: Newbie
Groups: Member

Joined: 4/30/2010
Posts: 6
Points: 18
Location: USA
I am still having this issue. Can anybody offer up advice or a possible solution as to why this is happening? The strange thing is that if you specify a position far enough into the FLV video, then it seems to go to the correct position. Howver, if you specify a position before that, then it jumps towards the end of the video.

Take my example, which includes a video that has a duration of 900 seconds:

Code:

// This code will jump the player towards the end of the video
ASPNetMedia.FlashVideo('myPlayer').SetPosition(85);

// This code will jump to the correct position
ASPNetMedia.FlashVideo('myPlayer').SetPosition(275);


Does this explanation of things help to pinpoint an exact issue?
Enzo
Posted: Wednesday, July 21, 2010 7:46:22 AM
Rank: Newbie
Groups: Member

Joined: 7/20/2010
Posts: 2
Points: 6
Location: UK
Hello there, any help would be great-full, I have the same issue. This is an "old" post but not answered yet.

E.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.