Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26033

iOS: Ti.Media.VideoPlayer shows an error on Window Close on SDK 7.1.1.GA

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.3.0
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      Ti.Media.VideoPlayer, iOS

    • Story Points:
      8
    • Sprint:
      2018 Sprint 10 SDK

      Description

      Hello,

      The following error occurs when closing a window with a video player control with SDK 7.1.1.GA on iOS. On Android, it works just fine.

      Test Environment:
      Appcelerator Command-Line Interface, version 7.0.3
      SDK: 7.1.1.GA

      Test code:
      index.xml

      <Alloy>
      	<Window class="container">
      		<Label id="label" onClick="doClick">Open Video Error Page</Label>
      	</Window>
      </Alloy>
      

      video.xml

      <Alloy>
      	<Window id="winVideo" backgroundColor="#cccccc">
          <Label id="videoLocalClose"></Label>
          <Label id="videoAdd" top="100" color="blue">Add Video First</Label>
          <Label id="videoPlay" top="200" color="purple">Then Play Video</Label>
      		<Label id="videoWindowClose" bottom="0" height="80" color="red">Close Window With Error</Label>
        </Window>
      </Alloy>
      

      index.js

      function doClick(e) {
      	Alloy.createController('video', {}).getView().open();
      }
      $.index.open();
      

      video.js

      var activeMovie = null;
      var videoMedia = null;
       
      $.videoAdd.addEventListener('click', function(e)
      {
        Ti.Media.showCamera({
              mediaTypes:                  [Ti.Media.MEDIA_TYPE_VIDEO],
              videoMaximumDuration:        300000,
              videoQuality:                Titanium.Media.QUALITY_MEDIUM,
              saveToPhotoGallery:          true,
              allowEditing:                false,
              success:function(e){
                  saveVideoLocal(e.media);
              }
          });
      });
       
      function saveVideoLocal(media) {
          videoMedia = media;
      }
       
      $.videoPlay.addEventListener('click', function(e)
      {
            activeMovie = Titanium.Media.createVideoPlayer({
                top : 0,
                width : '100%',
                bottom:100,
                visible:true,
                zIndex:999999,
                mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,
                scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FILL,
                autoplay : true,
                media: videoMedia
            });
            // Now if I use url instead of media then the video will not play. ( Same of android and iOS)
            // If I put a fake url like (url: 'http://fakeMovie.com' and still set media property the video will not play but error will not be thrown)
            // You can even put both media and url key above to same videoMedia and it will throw the error.
            // Looks like you have to set the url key at the creation of the control to not throw the error.
              // But url does not seem to be working for local media where the media key should be used.
       
            // Also when I get the script error the app will not crash but it will also not recognize
              //any future clicks on the listview control on the page that opened the video page.
       
            $.winVideo.add(activeMovie);
      });
      $.videoWindowClose.addEventListener('click', function(e)
      {
        $.winVideo.close();
      });
      $.winVideo.addEventListener('close', function(e)
      {
        if (activeMovie != null) {
            activeMovie.release();
            $.winVideo.remove(activeMovie);
        }
        activeMovie = null;
       
        $.destroy();
        $.off();
        $.winVideo = null;
      });
      

      index.tss

      ".container": {
      	backgroundColor:"white"
      }
       
      "Label": {
      	width: Ti.UI.SIZE,
      	height: Ti.UI.SIZE,
      	color: "#000"
      }
       
      "#label": {
      	font: {
      		fontSize: 12
      	}
      }
      

      alloy.js

      Attach in the text file

      Note: Also I have added the full project on the attachment file.
      Error:

      [ERROR] :  Script Error {
      [ERROR] :      column = 24;
      [ERROR] :      line = 119;
      [ERROR] :      message = "Cannot remove an observer <TiMediaVideoPlayerProxy 0x11808d000> for the key path \"url\" from <TiMediaVideoPlayerProxy 0x11808d000> because it is not registered as an observer.";
      [ERROR] :  }
      

      In this test code customer used media in the create command to play a video stored on the local device. If they put a fake url in the create it won't throw the error but even though they set the media later then it will not play the video. Again, this only happens on iOS.

      Thanks

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vijaysingh Vijay Singh
                Reporter:
                mrahman Mostafizur Rahman
                Reviewer:
                Hans Knöchel
                Tester:
                Samir Mohammed
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-6337
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code