Bug? B4i v2.0, VideoView and iOS 9 beta 3

Discussion in 'iOS Bugs & Wishlist' started by Pendrush, Jul 9, 2015.

  1. Pendrush

    Pendrush Active Member Licensed User

    Run this code

    Code:
    'Code module
    #Region  Project Attributes
        
    #ApplicationLabel: B4i Example
        
    #Version: 1.0.0
        
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
        #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
        
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #End Region

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'Public variables can be accessed from all modules.
        Public App As Application
        
    Public NavControl As NavigationController
        
    Private Page1 As Page

        
    Private VideoV As VideoView
        
    Private btnStop As Button
        
    Private btnPlay As Button
       
    End Sub

    Private Sub Application_Start (Nav As NavigationController)
       
        NavControl = Nav
        Page1.Initialize(
    "Page1")
        Page1.Title = 
    "Page 1"
        Page1.RootPanel.Color = 
    Colors.White
        
    'NavControl.ShowPage(Page1)
       
               
        VideoV.Initialize(
    "VideoV")
        btnStop.Initialize(
    "btnStop", btnStop.STYLE_SYSTEM)
        btnPlay.Initialize(
    "btnPlay", btnPlay.STYLE_SYSTEM)
       
        Page1.RootPanel.AddView(btnStop, 
    0010050)
        Page1.RootPanel.AddView(btnPlay, 
    0010050)
        Page1.RootPanel.AddView(VideoV.View, 
    00100%x100%y)
       
        btnPlay.Text = 
    "Play"
        btnStop.Text = 
    "Stop"
        btnPlay.Color = 
    Colors.LightGray
        btnStop.Color = 
    Colors.LightGray
       
        VideoV.ShowControls = 
    False
                   
        NavControl.ShowPage(Page1)
       
        CallSubDelayed(Me, 
    "PlayVideo")
       
       
    End Sub

    Private Sub Page1_Resize(Width As Int, Height As Int)
       
        VideoV.View.Height = Height
        VideoV.View.Width = Width
       
        btnPlay.Top = Height - btnPlay.Height
        btnStop.Top = Height - btnStop.Height
        btnStop.Left = Width - btnStop.Width
       
        btnPlay.BringToFront
        btnStop.BringToFront
           
    End Sub

    Private Sub Application_Background
       
    End Sub

    Public Sub PlayVideo
       
        VideoV.Stop
        VideoV.LoadVideoUrl(
    "https://devimages.apple.com.edgekey.net/iphone/samples/bipbop/bipbopall.m3u8")
       
    End Sub


    Private Sub VideoV_Ready
       
        VideoV.Play
       
    End Sub


    Private Sub btnPlay_Click
       
        PlayVideo
       
    End Sub

    Private Sub btnStop_Click

        VideoV.Stop
       
    End Sub
    wait few second for video to start, wait few more seconds, click on Stop, then click on Play and after 10-15 seconds app crash with this log

    Code:
    Application_Start
    Application_Active
    Error occurred on line: 
    84 (Main)
    An AVPlayerItem cannot be associated with more than one instance of AVPlayer
    Stack Trace: (
      CoreFoundation       <redacted> + 
    150
      libobjc.A.dylib      objc_exception_throw + 
    38
      AVFoundation         <redacted> + 
    382
      AVFoundation         <redacted> + 
    266
      
    MediaPlayer          <redacted> + 50
      
    MediaPlayer          <redacted> + 1368
      
    MediaPlayer          <redacted> + 1272
      
    MediaPlayer          <redacted> + 24
      libdispatch.dylib    <redacted> + 
    10
      libdispatch.dylib    <redacted> + 
    22
    libdispatch.dylib    _dispatch_main_queue_callback_4CF + 
    1516
    CoreFoundation       <redacted> + 
    8
    CoreFoundation       <redacted> + 
    1590
    CoreFoundation       CFRunLoopRunSpecific + 
    516
    CoreFoundation       CFRunLoopRunInMode + 
    108
    GraphicsServices     GSEventRunModal + 
    160
    UIKit                UIApplicationMain + 
    144
    B4i Example          main + 
    108
    libdyld.dylib        <redacted> + 
    2
    )
    This work fine on iOS 8.3 also on 8.4 in Simulator.

    Only work around is to initialize VideoView again (as new VideoView) and run video in that new VideoView.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Seems like a bug in iOS 9 beta.
     
  3. Pendrush

    Pendrush Active Member Licensed User

    I'm unable to find any submitted bug of this or similar (MPMoviePlayer) error on Apple's official beta forum.
    I hope it's just on bug in this beta version or I need to change 5-6 apps for my customers :(
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    The reason I think that it is a bug in iOS is that the wrapper doesn't do anything special when you call Play.
     
  5. Pendrush

    Pendrush Active Member Licensed User

    Last edited: Jul 10, 2015
  6. Erel

    Erel Administrator Staff Member Licensed User

    I think that you will need to reinitialize the VideoView before you start the second video.
     
    Pendrush likes this.
Loading...