iOS Question Play video in iOS from url

nicieri

Active Member
Licensed User
Longtime User
Hi, when I try this:

viv.LoadVideoUrl(lnk)
viv.Play

The VideoView is Black, the duration is 0, I think that the vv couldn't play the video ("https"), this problem I have too in the B4A with the same file "https", but in B4A i was solved with open the video in an external App, with Intent.

Android:

Dim i As Intent
i.Initialize(i.ACTION_VIEW,lnk)
i.SetType("video/*")
StartActivity(i)

iOS ??? How can I open the link Video in an Explorer or External VideoPlayer ?

Intent in iOS ??
 

Pablo Torres

Active Member
Licensed User
Longtime User
I have the same problem, videoview is showing only black, here is the code:
B4X:
  Dim webVideo As VideoView
  webVideo.Initialize("Video")
  scvLote.Panel.AddView(webVideo.View,0,h,Ancho,Ancho*(3/4))
  webVideo.ShowControls=True
  webVideo.LoadVideo(File.DirAssets,"videoPrueba.mp4")
  webVideo.View.Visible=True
  webVideo.Play

what I´m doing wrong?

i am adding this videovoewer to a scrollview, but I only can see it black, no controls, no playing video... I don´t know what to do[/code]
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Complete example that plays a video file that was added to the Files tab:
B4X:
Sub Process_Globals
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page
   Private vv As VideoView
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)
   vv.Initialize("vv")
   Page1.RootPanel.AddView(vv.View, 0, 0, 300, 300)
   vv.LoadVideo(File.DirAssets, "HelloWorld.mp4")
   vv.Play
End Sub
 
Upvote 0

Pablo Torres

Active Member
Licensed User
Longtime User
Hi, Erel

It works great with internal video
It doesn't work with url video
The video viewer gets all black, does not show the controls and the Ready event is not firing.
I just wanted to play a youtube video, Could that be the cause?
 
Upvote 0

victormedranop

Well-Known Member
Licensed User
Longtime User
hi, trying to run this code, but no video. I am using an emulator.
I don't know if that's the problem.

run without error

some help please

thanks victor.

B4X:
'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
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 7
#End Region
Sub [B]Process_Globals[/B]
'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
Dim videoview1 As VideoView
End Sub
Private Sub [B]Application_Start[/B] (Nav As NavigationController)
NavControl = Nav
videoview1.Initialize("videoview1")
Page1.Initialize("Page1")
Page1.RootPanel.AddView(videoview1.View,0%x,0%y,100%x,49%y)
Page1.RootPanel.LoadLayout("main")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
videoview1.LoadVideoUrl("http://stream3.prostudionetwork.com:1950/salvador/MOVIL/playlist.m3u8")
videoview1.ShowControls = True
videoview1.Play
End Sub
Private Sub [B]Page1_Resize[/B](Width As Int, Height As Int)
End Sub
Private Sub [B]Application_Background[/B]
End Sub
Private Sub [B]videoview1_Ready[/B]
Log("Videoview1 ready")
End Sub
[\code]
 
Upvote 0

Pablo Torres

Active Member
Licensed User
Longtime User
Hi, I`trying to use the following code, but it's not working.

B4X:
Sub Process_Globals
    Private RepVideo As VideoView
    Public App As Application
    Public NavControl As NavigationController
end sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    RepVideo.Initialize("ReproductorVideo")
    RepVideo.ShowControls=True
    pagVideo.Initialize("Video")
    pagVideo.RootPanel.LoadLayout("Video")
    pagVideo.RootPanel.AddView(RepVideo.View,0,0,100%x,100%y)
end sub

Sub btnVideo_ItemClick ()
    RepVideo.LoadVideoUrl("softuy.ddns.net:8080/Cafemax/1.mp4")
    RepVideo.Play
    NavControl.ShowPage(pagVideo)
End Sub

Can anyone help me?
 
Upvote 0
Top