Codename one video crashing on iOS when fast foward/ reverse button pressed












1















We have a video supply app written in Codename one.

We are using com.codename1.media.MediaPlayer to show the video full screen using the native player components.

Our client has noticed that when you press the fast forward(>>) button or the reverse button(<<) then the video is kicking you back to the app.



The code which plays the video looks something like this;



...
private Media video;
...
(on EDT:)
InputStream input = {get video InputStream from path}
video = MediaManager.createMedia(input, "video/mp4", this::videoFinished);
video.setFullScreen(true);
video.setNativePlayerMode(true);
....
(after pressing the play button:)
if (video.isPlaying()) {
video.setTime(0);
video.pause();
}
video.prepare();
video.play();
...
private void videoFinished() {
{update UI after video has finished}
}


I collected the following log from the console if that helps;



2018-11-01 15:08:38.290366+1300 Main[2000:481106]  <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)
2018-11-01 15:08:39.058905+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_Presence (client: Main)
2018-11-01 15:09:00.005725+1300 Main[2000:481106] Status bar could not find cached time string image. Rendering in-process.
2018-11-01 15:09:00.144446+1300 Main[2000:481106] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x10eb09790 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.midY == _UIBackdropView:0x108d59fb0.midY (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x10eb0abd0 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.height == _UIBackdropView:0x108d59fb0.height (active)>",
"<NSLayoutConstraint:0x10ccf2440 V:|-(0)-[UIStatusBar:0x102922200] (active, names: '|':_UIBackdropContentView:0x108d4a310 )>",
"<NSLayoutConstraint:0x10ccf24e0 UIStatusBar:0x102922200.height == 20 (active)>",
"<NSLayoutConstraint:0x10ccf2bf0 UIView:0x10cce7e10.top == _UIBackdropView:0x108d59fb0.top + 40 (active)>",
"<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-11-01 15:09:00.687662+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)


Everything works correctly on Android.



Edit:



Refactored the code to use file URL's instead of input streams but it still has the same error on iOS



Edit:



This is a problem even when using web urls.

Here is a very simple test case which illustrates the issue;



public class MyApplication {

private Form current;
private Resources theme;
private Media video;

public void init(Object context) {
// use two network threads instead of one
updateNetworkThreadCount(2);

theme = UIManager.initFirstTheme("/theme");

// Enable Toolbar on all Forms by default
Toolbar.setGlobalToolbar(true);

// Pro only feature
Log.bindCrashProtection(true);

addNetworkErrorListener(err -> {
// prevent the event from propagating
err.consume();
if(err.getError() != null) {
Log.e(err.getError());
}
Log.sendLogAsync();
Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
});
}

public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
//hi.add(new Label("Hi World"));
Button play = new Button("Play");
play.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
playVideo();
}


});
hi.add(play);
hi.show();
}

private void playVideo() {
try {
String path = getPath();
video = MediaManager.createMedia(path, true, null);
video.setFullScreen(true);
video.setNativePlayerMode(true);

video.prepare();
video.play();
} catch (IOException ex) {
Log.e(ex);
}
}

private String getPath() {
return "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
}
public void stop() {
current = getCurrentForm();
if(current instanceof Dialog) {
((Dialog)current).dispose();
current = getCurrentForm();
}
}

public void destroy() {
}
}


Note: To run this on ios you need to add the security exception to the plistInject build hint. Add this into the codenameone_settings.properties file;



codename1.arg.ios.plistInject=<key>UIRequiresFullScreen</key><true/><key>ITSAppUsesNonExemptEncryption</key><false/><key>NSAppTransportSecurity</key><dict><key>NSExceptionDomains</key><dict><key>commondatastorage.googleapis.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>









share|improve this question





























    1















    We have a video supply app written in Codename one.

    We are using com.codename1.media.MediaPlayer to show the video full screen using the native player components.

    Our client has noticed that when you press the fast forward(>>) button or the reverse button(<<) then the video is kicking you back to the app.



    The code which plays the video looks something like this;



    ...
    private Media video;
    ...
    (on EDT:)
    InputStream input = {get video InputStream from path}
    video = MediaManager.createMedia(input, "video/mp4", this::videoFinished);
    video.setFullScreen(true);
    video.setNativePlayerMode(true);
    ....
    (after pressing the play button:)
    if (video.isPlaying()) {
    video.setTime(0);
    video.pause();
    }
    video.prepare();
    video.play();
    ...
    private void videoFinished() {
    {update UI after video has finished}
    }


    I collected the following log from the console if that helps;



    2018-11-01 15:08:38.290366+1300 Main[2000:481106]  <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)
    2018-11-01 15:08:39.058905+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_Presence (client: Main)
    2018-11-01 15:09:00.005725+1300 Main[2000:481106] Status bar could not find cached time string image. Rendering in-process.
    2018-11-01 15:09:00.144446+1300 Main[2000:481106] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want.
    Try this:
    (1) look at each constraint and try to figure out which you don't expect;
    (2) find the code that added the unwanted constraint or constraints and fix it.
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
    (
    "<NSAutoresizingMaskLayoutConstraint:0x10eb09790 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.midY == _UIBackdropView:0x108d59fb0.midY (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x10eb0abd0 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.height == _UIBackdropView:0x108d59fb0.height (active)>",
    "<NSLayoutConstraint:0x10ccf2440 V:|-(0)-[UIStatusBar:0x102922200] (active, names: '|':_UIBackdropContentView:0x108d4a310 )>",
    "<NSLayoutConstraint:0x10ccf24e0 UIStatusBar:0x102922200.height == 20 (active)>",
    "<NSLayoutConstraint:0x10ccf2bf0 UIView:0x10cce7e10.top == _UIBackdropView:0x108d59fb0.top + 40 (active)>",
    "<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>"
    )

    Will attempt to recover by breaking constraint
    <NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
    2018-11-01 15:09:00.687662+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)


    Everything works correctly on Android.



    Edit:



    Refactored the code to use file URL's instead of input streams but it still has the same error on iOS



    Edit:



    This is a problem even when using web urls.

    Here is a very simple test case which illustrates the issue;



    public class MyApplication {

    private Form current;
    private Resources theme;
    private Media video;

    public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
    // prevent the event from propagating
    err.consume();
    if(err.getError() != null) {
    Log.e(err.getError());
    }
    Log.sendLogAsync();
    Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
    }

    public void start() {
    if(current != null){
    current.show();
    return;
    }
    Form hi = new Form("Hi World", BoxLayout.y());
    //hi.add(new Label("Hi World"));
    Button play = new Button("Play");
    play.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent evt) {
    playVideo();
    }


    });
    hi.add(play);
    hi.show();
    }

    private void playVideo() {
    try {
    String path = getPath();
    video = MediaManager.createMedia(path, true, null);
    video.setFullScreen(true);
    video.setNativePlayerMode(true);

    video.prepare();
    video.play();
    } catch (IOException ex) {
    Log.e(ex);
    }
    }

    private String getPath() {
    return "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
    }
    public void stop() {
    current = getCurrentForm();
    if(current instanceof Dialog) {
    ((Dialog)current).dispose();
    current = getCurrentForm();
    }
    }

    public void destroy() {
    }
    }


    Note: To run this on ios you need to add the security exception to the plistInject build hint. Add this into the codenameone_settings.properties file;



    codename1.arg.ios.plistInject=<key>UIRequiresFullScreen</key><true/><key>ITSAppUsesNonExemptEncryption</key><false/><key>NSAppTransportSecurity</key><dict><key>NSExceptionDomains</key><dict><key>commondatastorage.googleapis.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>









    share|improve this question



























      1












      1








      1


      1






      We have a video supply app written in Codename one.

      We are using com.codename1.media.MediaPlayer to show the video full screen using the native player components.

      Our client has noticed that when you press the fast forward(>>) button or the reverse button(<<) then the video is kicking you back to the app.



      The code which plays the video looks something like this;



      ...
      private Media video;
      ...
      (on EDT:)
      InputStream input = {get video InputStream from path}
      video = MediaManager.createMedia(input, "video/mp4", this::videoFinished);
      video.setFullScreen(true);
      video.setNativePlayerMode(true);
      ....
      (after pressing the play button:)
      if (video.isPlaying()) {
      video.setTime(0);
      video.pause();
      }
      video.prepare();
      video.play();
      ...
      private void videoFinished() {
      {update UI after video has finished}
      }


      I collected the following log from the console if that helps;



      2018-11-01 15:08:38.290366+1300 Main[2000:481106]  <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)
      2018-11-01 15:08:39.058905+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_Presence (client: Main)
      2018-11-01 15:09:00.005725+1300 Main[2000:481106] Status bar could not find cached time string image. Rendering in-process.
      2018-11-01 15:09:00.144446+1300 Main[2000:481106] [LayoutConstraints] Unable to simultaneously satisfy constraints.
      Probably at least one of the constraints in the following list is one you don't want.
      Try this:
      (1) look at each constraint and try to figure out which you don't expect;
      (2) find the code that added the unwanted constraint or constraints and fix it.
      (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
      (
      "<NSAutoresizingMaskLayoutConstraint:0x10eb09790 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.midY == _UIBackdropView:0x108d59fb0.midY (active)>",
      "<NSAutoresizingMaskLayoutConstraint:0x10eb0abd0 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.height == _UIBackdropView:0x108d59fb0.height (active)>",
      "<NSLayoutConstraint:0x10ccf2440 V:|-(0)-[UIStatusBar:0x102922200] (active, names: '|':_UIBackdropContentView:0x108d4a310 )>",
      "<NSLayoutConstraint:0x10ccf24e0 UIStatusBar:0x102922200.height == 20 (active)>",
      "<NSLayoutConstraint:0x10ccf2bf0 UIView:0x10cce7e10.top == _UIBackdropView:0x108d59fb0.top + 40 (active)>",
      "<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>"
      )

      Will attempt to recover by breaking constraint
      <NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>

      Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
      The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
      2018-11-01 15:09:00.687662+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)


      Everything works correctly on Android.



      Edit:



      Refactored the code to use file URL's instead of input streams but it still has the same error on iOS



      Edit:



      This is a problem even when using web urls.

      Here is a very simple test case which illustrates the issue;



      public class MyApplication {

      private Form current;
      private Resources theme;
      private Media video;

      public void init(Object context) {
      // use two network threads instead of one
      updateNetworkThreadCount(2);

      theme = UIManager.initFirstTheme("/theme");

      // Enable Toolbar on all Forms by default
      Toolbar.setGlobalToolbar(true);

      // Pro only feature
      Log.bindCrashProtection(true);

      addNetworkErrorListener(err -> {
      // prevent the event from propagating
      err.consume();
      if(err.getError() != null) {
      Log.e(err.getError());
      }
      Log.sendLogAsync();
      Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
      });
      }

      public void start() {
      if(current != null){
      current.show();
      return;
      }
      Form hi = new Form("Hi World", BoxLayout.y());
      //hi.add(new Label("Hi World"));
      Button play = new Button("Play");
      play.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent evt) {
      playVideo();
      }


      });
      hi.add(play);
      hi.show();
      }

      private void playVideo() {
      try {
      String path = getPath();
      video = MediaManager.createMedia(path, true, null);
      video.setFullScreen(true);
      video.setNativePlayerMode(true);

      video.prepare();
      video.play();
      } catch (IOException ex) {
      Log.e(ex);
      }
      }

      private String getPath() {
      return "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
      }
      public void stop() {
      current = getCurrentForm();
      if(current instanceof Dialog) {
      ((Dialog)current).dispose();
      current = getCurrentForm();
      }
      }

      public void destroy() {
      }
      }


      Note: To run this on ios you need to add the security exception to the plistInject build hint. Add this into the codenameone_settings.properties file;



      codename1.arg.ios.plistInject=<key>UIRequiresFullScreen</key><true/><key>ITSAppUsesNonExemptEncryption</key><false/><key>NSAppTransportSecurity</key><dict><key>NSExceptionDomains</key><dict><key>commondatastorage.googleapis.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>









      share|improve this question
















      We have a video supply app written in Codename one.

      We are using com.codename1.media.MediaPlayer to show the video full screen using the native player components.

      Our client has noticed that when you press the fast forward(>>) button or the reverse button(<<) then the video is kicking you back to the app.



      The code which plays the video looks something like this;



      ...
      private Media video;
      ...
      (on EDT:)
      InputStream input = {get video InputStream from path}
      video = MediaManager.createMedia(input, "video/mp4", this::videoFinished);
      video.setFullScreen(true);
      video.setNativePlayerMode(true);
      ....
      (after pressing the play button:)
      if (video.isPlaying()) {
      video.setTime(0);
      video.pause();
      }
      video.prepare();
      video.play();
      ...
      private void videoFinished() {
      {update UI after video has finished}
      }


      I collected the following log from the console if that helps;



      2018-11-01 15:08:38.290366+1300 Main[2000:481106]  <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)
      2018-11-01 15:08:39.058905+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_Presence (client: Main)
      2018-11-01 15:09:00.005725+1300 Main[2000:481106] Status bar could not find cached time string image. Rendering in-process.
      2018-11-01 15:09:00.144446+1300 Main[2000:481106] [LayoutConstraints] Unable to simultaneously satisfy constraints.
      Probably at least one of the constraints in the following list is one you don't want.
      Try this:
      (1) look at each constraint and try to figure out which you don't expect;
      (2) find the code that added the unwanted constraint or constraints and fix it.
      (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
      (
      "<NSAutoresizingMaskLayoutConstraint:0x10eb09790 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.midY == _UIBackdropView:0x108d59fb0.midY (active)>",
      "<NSAutoresizingMaskLayoutConstraint:0x10eb0abd0 h=-&- v=-&- _UIBackdropContentView:0x108d4a310.height == _UIBackdropView:0x108d59fb0.height (active)>",
      "<NSLayoutConstraint:0x10ccf2440 V:|-(0)-[UIStatusBar:0x102922200] (active, names: '|':_UIBackdropContentView:0x108d4a310 )>",
      "<NSLayoutConstraint:0x10ccf24e0 UIStatusBar:0x102922200.height == 20 (active)>",
      "<NSLayoutConstraint:0x10ccf2bf0 UIView:0x10cce7e10.top == _UIBackdropView:0x108d59fb0.top + 40 (active)>",
      "<NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>"
      )

      Will attempt to recover by breaking constraint
      <NSLayoutConstraint:0x10ccf26e0 V:[UIStatusBar:0x102922200]-(0)-[UIView:0x10cce7e10] (active)>

      Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
      The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
      2018-11-01 15:09:00.687662+1300 Main[2000:481106] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: Main)


      Everything works correctly on Android.



      Edit:



      Refactored the code to use file URL's instead of input streams but it still has the same error on iOS



      Edit:



      This is a problem even when using web urls.

      Here is a very simple test case which illustrates the issue;



      public class MyApplication {

      private Form current;
      private Resources theme;
      private Media video;

      public void init(Object context) {
      // use two network threads instead of one
      updateNetworkThreadCount(2);

      theme = UIManager.initFirstTheme("/theme");

      // Enable Toolbar on all Forms by default
      Toolbar.setGlobalToolbar(true);

      // Pro only feature
      Log.bindCrashProtection(true);

      addNetworkErrorListener(err -> {
      // prevent the event from propagating
      err.consume();
      if(err.getError() != null) {
      Log.e(err.getError());
      }
      Log.sendLogAsync();
      Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
      });
      }

      public void start() {
      if(current != null){
      current.show();
      return;
      }
      Form hi = new Form("Hi World", BoxLayout.y());
      //hi.add(new Label("Hi World"));
      Button play = new Button("Play");
      play.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent evt) {
      playVideo();
      }


      });
      hi.add(play);
      hi.show();
      }

      private void playVideo() {
      try {
      String path = getPath();
      video = MediaManager.createMedia(path, true, null);
      video.setFullScreen(true);
      video.setNativePlayerMode(true);

      video.prepare();
      video.play();
      } catch (IOException ex) {
      Log.e(ex);
      }
      }

      private String getPath() {
      return "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
      }
      public void stop() {
      current = getCurrentForm();
      if(current instanceof Dialog) {
      ((Dialog)current).dispose();
      current = getCurrentForm();
      }
      }

      public void destroy() {
      }
      }


      Note: To run this on ios you need to add the security exception to the plistInject build hint. Add this into the codenameone_settings.properties file;



      codename1.arg.ios.plistInject=<key>UIRequiresFullScreen</key><true/><key>ITSAppUsesNonExemptEncryption</key><false/><key>NSAppTransportSecurity</key><dict><key>NSExceptionDomains</key><dict><key>commondatastorage.googleapis.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>






      ios video codenameone






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 3:17







      peopletookallthegoodnames

















      asked Nov 1 '18 at 20:50









      peopletookallthegoodnamespeopletookallthegoodnames

      438312




      438312
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Seeking with an input stream might be a bit problematic as we can't rewind/skip in the stream effectively while communicating with the native layer. That's why we always recommend using the version that accepts a URL as an argument. You can use a file URL which should work well for all platforms.






          share|improve this answer
























          • I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

            – peopletookallthegoodnames
            Nov 6 '18 at 1:41











          • Does this happen consistently with every video? Can you isolate it to a test case we can run?

            – Shai Almog
            Nov 6 '18 at 5:04











          • It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

            – peopletookallthegoodnames
            Nov 6 '18 at 22:33











          • Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

            – Shai Almog
            Nov 7 '18 at 4:37











          • I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

            – peopletookallthegoodnames
            Nov 14 '18 at 3:18











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53109159%2fcodename-one-video-crashing-on-ios-when-fast-foward-reverse-button-pressed%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Seeking with an input stream might be a bit problematic as we can't rewind/skip in the stream effectively while communicating with the native layer. That's why we always recommend using the version that accepts a URL as an argument. You can use a file URL which should work well for all platforms.






          share|improve this answer
























          • I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

            – peopletookallthegoodnames
            Nov 6 '18 at 1:41











          • Does this happen consistently with every video? Can you isolate it to a test case we can run?

            – Shai Almog
            Nov 6 '18 at 5:04











          • It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

            – peopletookallthegoodnames
            Nov 6 '18 at 22:33











          • Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

            – Shai Almog
            Nov 7 '18 at 4:37











          • I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

            – peopletookallthegoodnames
            Nov 14 '18 at 3:18
















          1














          Seeking with an input stream might be a bit problematic as we can't rewind/skip in the stream effectively while communicating with the native layer. That's why we always recommend using the version that accepts a URL as an argument. You can use a file URL which should work well for all platforms.






          share|improve this answer
























          • I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

            – peopletookallthegoodnames
            Nov 6 '18 at 1:41











          • Does this happen consistently with every video? Can you isolate it to a test case we can run?

            – Shai Almog
            Nov 6 '18 at 5:04











          • It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

            – peopletookallthegoodnames
            Nov 6 '18 at 22:33











          • Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

            – Shai Almog
            Nov 7 '18 at 4:37











          • I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

            – peopletookallthegoodnames
            Nov 14 '18 at 3:18














          1












          1








          1







          Seeking with an input stream might be a bit problematic as we can't rewind/skip in the stream effectively while communicating with the native layer. That's why we always recommend using the version that accepts a URL as an argument. You can use a file URL which should work well for all platforms.






          share|improve this answer













          Seeking with an input stream might be a bit problematic as we can't rewind/skip in the stream effectively while communicating with the native layer. That's why we always recommend using the version that accepts a URL as an argument. You can use a file URL which should work well for all platforms.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 2 '18 at 3:28









          Shai AlmogShai Almog

          40.3k52555




          40.3k52555













          • I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

            – peopletookallthegoodnames
            Nov 6 '18 at 1:41











          • Does this happen consistently with every video? Can you isolate it to a test case we can run?

            – Shai Almog
            Nov 6 '18 at 5:04











          • It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

            – peopletookallthegoodnames
            Nov 6 '18 at 22:33











          • Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

            – Shai Almog
            Nov 7 '18 at 4:37











          • I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

            – peopletookallthegoodnames
            Nov 14 '18 at 3:18



















          • I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

            – peopletookallthegoodnames
            Nov 6 '18 at 1:41











          • Does this happen consistently with every video? Can you isolate it to a test case we can run?

            – Shai Almog
            Nov 6 '18 at 5:04











          • It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

            – peopletookallthegoodnames
            Nov 6 '18 at 22:33











          • Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

            – Shai Almog
            Nov 7 '18 at 4:37











          • I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

            – peopletookallthegoodnames
            Nov 14 '18 at 3:18

















          I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

          – peopletookallthegoodnames
          Nov 6 '18 at 1:41





          I just spent most of my day refactoring to use file path URLs for the arguments and it did not at all fix the issue. It's still failing with exactly the same error

          – peopletookallthegoodnames
          Nov 6 '18 at 1:41













          Does this happen consistently with every video? Can you isolate it to a test case we can run?

          – Shai Almog
          Nov 6 '18 at 5:04





          Does this happen consistently with every video? Can you isolate it to a test case we can run?

          – Shai Almog
          Nov 6 '18 at 5:04













          It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

          – peopletookallthegoodnames
          Nov 6 '18 at 22:33





          It seems to happen with all the videos we've tried. unfortuently they are our clients IP so I can't send those videos specifically. They are mp4's which have been encoded to be as compatible to ios and android as possible

          – peopletookallthegoodnames
          Nov 6 '18 at 22:33













          Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

          – Shai Almog
          Nov 7 '18 at 4:37





          Can you try creating a simple mp4, any such video should work on iOS & Android. You can use most screen capture software to generate such a video. Then just isolate a test case/issue based on that

          – Shai Almog
          Nov 7 '18 at 4:37













          I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

          – peopletookallthegoodnames
          Nov 14 '18 at 3:18





          I've updated my post with a minimal example. I've used a public domain video but you could point it at any url for testing.

          – peopletookallthegoodnames
          Nov 14 '18 at 3:18


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53109159%2fcodename-one-video-crashing-on-ios-when-fast-foward-reverse-button-pressed%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python