Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34437

Underlying Components of Spark:VideoDisplay control enter invalid state after losing focus

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Apache Flex 4.12.0, Apache Flex 4.13.0, Apache Flex 4.12.1
    • None
    • Spark: VideoPlayer
    • Windows 8.1 x64 8GB I7 IntelliJ, Flex 4.12.1
      Mac OS X 10.9, 4GB I5 Intellij Flex 4.12.1

    Description

      When using the spark:VideoDisplay control in Flex versions above 12.0, with stage video fix applied:
      OSMFSettings.enableStageVideo = false;

      an error is received once the video player is minimized, hidden, or loses focus for a period of time. It appears that one of the components enters and invalid state ( OSMF?) and reports a state of loading / buffering even though video is finished. When cleanup is run or new source added the error listed below occurs. Workaround is to manually clear the video when the screen is hidden / transitions - code snippet provided below that may help.

      Error / Exception Received:
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at org.osmf.media::MediaPlayer/getTraitOrThrow()
      at org.osmf.media::MediaPlayer/play()
      at Function/<anonymous>()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at org.osmf.media::MediaPlayer/updateTraitListeners()
      at org.osmf.media::MediaPlayer/onTraitRemove()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at org.osmf.media::MediaElement/setLocalTrait()
      at org.osmf.media::MediaElement/removeTrait()
      at org.osmf.elements::LightweightVideoElement/processUnloadingState()
      at org.osmf.media::LoadableElementBase/onLoadStateChange()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at org.osmf.traits::LoadTrait/loadStateChangeEnd()
      at org.osmf.traits::LoadTrait/setLoadState()
      at org.osmf.traits::LoadTrait/onLoadStateChange()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at org.osmf.traits::LoaderBase/updateLoadTrait()
      at org.osmf.net::NetLoader/executeUnload()
      at org.osmf.traits::LoaderBase/unload()
      at org.osmf.traits::LoadTrait/unload()
      at org.osmf.media::MediaPlayer/set media()
      at spark.components::VideoDisplay/setUpSource()[/Users/aharui/flex-sdk-4.12.1/frameworks/projects/spark/src/spark/components/VideoDisplay.as:1717]
      at spark.components::VideoDisplay/set source()[/Users/aharui/flex-sdk-4.12.1/frameworks/projects/spark/src/spark/components/VideoDisplay.as:1081]
      at view.activities::FullScreenVideo/setupFromContentMap()[C:\Users\Quinn\projects\dpa\DPA\workspace\dapApplication\src\view\activities\FullScreenVideo.mxml:32]
      at view.components::ActivityBase/set contentMap()[C:\Users\Quinn\projects\dpa\DPA\workspace\dapApplication\src\view\components\ActivityBase.as:83]
      at view::ContentView/handleShowScreen()[C:\Users\Quinn\projects\dpa\DPA\workspace\dapApplication\src\view\ContentView.mxml:86]
      at view::ContentView/___ContentView_State10_enterState()[C:\Users\Quinn\projects\dpa\DPA\workspace\dapApplication\src\view\ContentView.mxml:128]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()

      Code Snippet with workaround: ( hope it doesn't look as nasty as it does in the entry box )
      protected override function setupFromContentMap(map:Object):void {
      super.setupFromContentMap(map);
      if (map != null) {
      // not sure I like how they have this setup
      if( videoPlayer.source != null )

      { videoPlayer.stopAllMovieClips(); }

      if (playVideoInstruction.video != null)

      { videoPlayer.source = playVideoInstruction.video; nextButton.visible = false; }

      if (playVideoInstruction.screenText != null) {
      screenText = playVideoInstruction.screenText;
      if (screenText.length > 0) {
      textBkg.visible = true;
      textArea.visible = true;
      try

      { textArea.textFlow = TextFlowUtil.importFromString(screenText); }

      catch (e:Error)

      { // need to popup something telling you the error textArea.text = "Text Formating Error: " + e.message; }

      }
      else

      { textBkg.visible = false; textArea.visible = false; }

      }
      else

      { textBkg.visible = false; textArea.visible = false; }

      }
      else {

      }
      }

      protected function videoPlayer_completeHandler(event:TimeEvent):void

      { // TODO Auto-generated method stub nextButton.visible = true; }

      protected override function nextButton_onClicked( me:MouseEvent ):void

      { // uncomment next two lines to work around issue // videoPlayer.stopAllMovieClips(); // videoPlayer.source = null; super.nextButton_onClicked(me); }

      ]]></fx:Script>

      <!--<s:BitmapImage id="videoBkg" x="81" y="79" width="100%" height="100%" source="

      {AssetLibrary.FLV_PLACEHOLDER}

      " />-->
      <s:BorderContainer top="52" left="0" right="0" bottom="64" backgroundColor="black" borderVisible="false">
      <s:VideoDisplay id="videoPlayer" width="100%" height="100%" scaleMode="letterbox" autoRewind="false" complete="videoPlayer_completeHandler(event)"/>
      </s:BorderContainer>

      Attachments

        Activity

          People

            Unassigned Unassigned
            qbuchanan Quinn Buchanan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: