It is currently Mon Sep 23, 2019 5:42 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: libVLC help
PostPosted: Sun Mar 03, 2019 6:22 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jan 20, 2014 6:32 pm
Posts: 240
I am trying to figure out how to make it work correctly its working right now but in a new window.

How can I make it play in the PB window and not in the VLC window?

Code:
Enumeration
  #winMain
  #canvasPlayer
  #libVLC
EndEnumeration

Define.i vlcInst, vlcPlayer, media

SetEnvironmentVariable("VLC_PLUGIN_PATH", "/usr/lib/vlc/plugins/")
OpenLibrary(libVLC, "/usr/lib/libvlc.so")

OpenWindow(winMain, 10, 10, 400, 300, "", #PB_Window_SystemMenu)
CanvasGadget(canvasPlayer, 0, 0, 400, 300, #PB_Canvas_Container)

vlcInst = CallFunction(libVLC, "libvlc_new", 0, #Null)
vlcPlayer = CallFunction(libVLC, "libvlc_media_player_new", vlcInst)

CallFunction(libVLC, "libvlc_media_player_set_xwindow", vlcPlayer, WindowID(winMain))

*mediaPath = Ascii("/home/user/Videos/test.mp4")
media = CallFunction(libVLC, "libvlc_media_new_path", vlcInst, *mediaPath)

CallFunction(libVLC, "libvlc_media_parse", media)
Debug "Duration: " + FormatDate ( "%hh:%ii:%ss",CallFunction(libVLC, "libvlc_media_get_duration", media)/ 1000 )

CallFunction(libVLC, "libvlc_media_player_set_media", vlcPlayer, media)
CallFunction(libVLC, "libvlc_media_player_play", vlcPlayer)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow


Thanks

_________________
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA


Top
 Profile  
Reply with quote  
 Post subject: Re: libVLC help
PostPosted: Sun Mar 03, 2019 6:55 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jan 20, 2014 6:32 pm
Posts: 240
On another note just playing around which way is more correct or better way to write it as in the first post or like this?

Code:
Enumeration
  #winMain
  #canvasPlayer
EndEnumeration

ImportC "-lvlc"
  libvlc_new.i(argc.i,argv.i)
  libvlc_media_player_new.i(*p_instance)
  libvlc_media_player_set_xwindow(*p_mi,drawable.i)
  libvlc_media_new_path(*p_instance,*path)
  libvlc_media_parse(*p_md)
  libvlc_media_get_duration(*p_md)
  libvlc_media_player_set_media(*p_mi,*p_md)
  libvlc_media_player_play(*p_mi)
EndImport

Define.i p_instance, p_mi, p_md

OpenWindow(winMain, 10, 10, 400, 300, "", #PB_Window_SystemMenu)
CanvasGadget(canvasPlayer, 0, 0, 400, 300, #PB_Canvas_Container)

p_instance = libvlc_new(0,#Null)
p_mi = libvlc_media_player_new(p_instance)

libvlc_media_player_set_xwindow(p_mi, WindowID(winMain))

*mediaPath = Ascii("/home/user/Videos/test.mp4")
p_md = libvlc_media_new_path(p_instance, *mediaPath)

libvlc_media_parse(p_md)
Debug "Duration: " + FormatDate ( "%hh:%ii:%ss",libvlc_media_get_duration(p_md)/ 1000 )

libvlc_media_player_set_media(p_mi, p_md)
libvlc_media_player_play(p_mi)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye