7

When initialising a SKVideoNode with a video URL in iOS9 the behaviour changed to automatically starting the video as soon as the node is added, i.s.o. after the play method is called in previous versions of iOS.

doing the following inside the SKScene init

SKVideoNode* videoNode = [SKVideoNode videoNodeWithVideoFileNamed:@"sample.m4v"];
[self addChild:videoNode];

is enough to see the video playing, while previous iOS versions (more logically) required to also call

[videoNode play];

before the video starts playing.

Is this an intended change? A possible workaround I see is always immediately calling pause after initialising a video but it's a bit weird this behaviour changed. (it feels like a bug to be honest)

(I also found the iOS9 simulator to have issues with SKVideoNodes playing at all, you have to test this on a device)

Bhavesh Nayi
  • 3,626
  • 1
  • 27
  • 42
Pieter
  • 17,435
  • 8
  • 50
  • 89
  • I've found a workaround, subclass `SKVideoNode` and its method `- (void)setPaused:(BOOL)paused`, check `[NSThread callStackSymbols]` to see if it's from your class, if yes, call `[super setPaused:paused]`. – CocoaBob Sep 22 '15 at 14:50
  • 1
    Same problem here... Also, `pause` and `isPaused` seem to be out of sync for me. I've never worked with iOS video APIs before but this and `MPMoviePlayerController` / `AVPlayer` are the worst APIs I've worked with so far (iOS-wise). – iosdude Oct 16 '16 at 11:00

0 Answers0