iOS Tutorial VideoPlayer - Replaces VideoView

Discussion in 'iOS Tutorials' started by Erel, Nov 28, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    iUI8 library v1.50 includes a new VideoPlayer view. It replaces VideoView from iMedia library.

    Apple has deprecated the API that VideoView was based on. VideoPlayer is based on the newer AVPlayerViewController.

    It is implemented as a custom view. Using it is simple.

    1. Add a reference to iUI8.
    2. Set #MinVersion: 8
    3. Add VideoPlayer with the designer.
    4. Load a video.
    5. Wait for the Ready event.
    6. Optionally call Play to start playing automatically.

    Code:
    Private Sub Application_Start (Nav As NavigationController)
       NavControl = Nav
       Page1.Initialize(
    "Page1")
       Page1.RootPanel.LoadLayout(
    "1")
       NavControl.ShowPage(Page1)
       VideoPlayer1.LoadVideo(
    File.DirAssets, "big_buck_bunny.mp4")
       
    Wait For VideoPlayer1_Ready (Success As Boolean)
       
    If Success Then
         VideoPlayer1.Play 
    'to start playing automatically
       End If
    End Sub
     

    Attached Files:

  2. Christian García S.

    Christian García S. Member Licensed User

    Hello, thanks for the library.

    I tested with B4i 5.00 and iUI8 and works fine, but I don't have sound, I do not know if this only happens with debug mode or also when I will publish the APP. I am using hosted builder and Iphone 6S plus.

    I tested with my own video and with bunny and both doesn't have sound.

    Thanks
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    It is not related to debug mode. Make sure that the phone is not in silent mode.
     
  4. Christian García S.

    Christian García S. Member Licensed User

    Thanks @Erel, I did tests with google chrome, putting the link in the browser, there if you can hear the sound in the application still does not sound.
     
  5. Christian García S.

    Christian García S. Member Licensed User

    Hello @Erel, can you help me or do you have an idea of how to solve the problem, I still can not publish the APP, the video still does not have audio.

    Thanks
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    1. Start a new thread in the questions forum.
    2. Upload a small example that demonstrates it.
     
  7. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    It's possible to put visible true/false?

    I've try like this but do not work:

    Code:
    VideoPlayer1.BaseView.Visible = False
    or change the size/position on runtime
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    It is a bug in iUI8. It is fixed for the next update of B4i.

    You can use this code instead to get the base view:
    Code:
    Private Sub GetBaseView(vp As VideoPlayer) As Panel
       
    Dim no As NativeObject = vp
       
    return no.GetField("controller").GetField("view").GetField("superview")
    End Sub
     
  9. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    ohh ok.. I can live with this until next version with no problem... Super thanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice