Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

FLVPlayBack.stop()

New Here ,
Feb 12, 2013 Feb 12, 2013

I have a flvplayback video player which uses a VideoEvent.PLAYHEAD_UPDATE event listener to drive a custom tape timer display. I am trying to use the event listener to also trigger a stop command to the video when the playheadTime reaches a certain value. Putting the .stop() method inside the event listener triggers a 1009 Error when it tries to execute. Using the .pause() method does work but it's not exactly what I'm looking for. Is there another way to trigger the stop?

TOPICS
ActionScript
929
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 12, 2013 Feb 12, 2013

Since Display is the only object being targeted in that line, and it is targeted in a line just before it without error, I suspect that line is not the first line in the trail of errors.  I think the error is erupting from within the FLVPlayback component at some line relevant to a function within it named closeNS().

It is possible there is something being processed in that function which gets nulled but then with another call to the function maybe it is failing from there on. 

What you might try

...
Translate
LEGEND ,
Feb 12, 2013 Feb 12, 2013

Show the code that is not working for you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2013 Feb 12, 2013
function playVideo(videoTitle:String, seekTime:String, stoptime:String):void
{
stopTime = (int(stoptime));
TimerLabel.text = "00:00:00 \\ 00:00:00";
Display.source = serverURL + videoTitle;
Display.seek(int(seekTime));
Display.addEventListener(VideoEvent.PLAYHEAD_UPDATE, updateTapeTimer);
Display.addEventListener(VideoEvent.STATE_CHANGE, playerStateHandler);
StatusLabel.text = Display.state;
}
function updateTapeTimer(event:VideoEvent):void
{
tapeTime = Display.playheadTime;
if(tapeTime > stopTime)
{
Display.stop();
}
var playHeadSecs:int = Math.round(Display.playheadTime);
var totalTimeSecs:int = Math.round(Display.totalTime);

... formatting code for tape timer display

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 12, 2013 Feb 12, 2013

Go into your Flash Publish Settings and select the option to Permit Debugging.  Run the file and see what line of code is being identified as the source of the problem in the 1009 error.  The line number should follow directly after the first frame number identified.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2013 Feb 12, 2013

Yes, debugginig is set and it shows the Display.stop() on line 371 as the culprit.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2013 Feb 12, 2013

Here's the beginning of the error output. It repeats for a good 10 seconds before it clears.

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::closeNS()

    at fl.video::VideoPlayer/stop()

    at fl.video::FLVPlayback/stop()

    at Function/Main/$construct/updateTapeTimer()

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::doUpdateTime()

    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::closeNS()

    at fl.video::VideoPlayer/stop()

    at fl.video::FLVPlayback/stop()

    at Function/Main/$construct/updateTapeTimer()

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::doUpdateTime()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 12, 2013 Feb 12, 2013

Since Display is the only object being targeted in that line, and it is targeted in a line just before it without error, I suspect that line is not the first line in the trail of errors.  I think the error is erupting from within the FLVPlayback component at some line relevant to a function within it named closeNS().

It is possible there is something being processed in that function which gets nulled but then with another call to the function maybe it is failing from there on. 

What you might try doing is removing the event listener inside the conditional so that it only executes the event handler until the event occurs and not afterwards.

if(tapeTime > stopTime){

   Display.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, updateTapeTimer);

   Display.stop();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2013 Feb 12, 2013

Thank you for your help Ned. I'm running out of time here so I will try your suggestion tomorrow and see how it goes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 14, 2013 Feb 14, 2013
LATEST

That works Ned. Thanks again for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines