Just starting out? Need help? Post your questions and find answers here.
-
skinkairewalker
- Posts: 120
- Joined: Tue Jun 14, 2016 7:17 pm
Post
by skinkairewalker »
hello everyone !!
i am trying Plyr VideoPlayer (
https://github.com/sampotts/plyr ) to learn about videos and stream
using this code below, when i run :
Code: Select all
Procedure AppendHead(content.s)
Debug "head"
!$("head").append(v_content);
EndProcedure
Procedure AppendBody(content.s)
!$("body").append(v_content);
EndProcedure
Procedure AppendContent(component.i,content.s, Position = #PB_Ignore)
GID = GadgetID(component)
If Position <> #PB_Ignore
! $(".card:eq(" + v_position + ")").prepend(v_content);
Else
! $(v_gid.div).append(v_content);
EndIf
EndProcedure
;Procedure AppendBody(content.s)
; !$("body").append(v_content);
;EndProcedure
Procedure Main()
AppendBody("<div id='player' data-plyr-provider='youtube' data-plyr-embed-id='bTqVqk7FSmY'></div>")
!const player = new Plyr('#player', {});
!window.player = player;
EndProcedure
Global nLoaded
Global nImports = 3
Procedure RequireScript(url.s, objName.s)
Debug "require entrou"
; EnableJS
! require([v_url], function(obj) {
! window[v_objname] = obj;
! v_nloaded++;
! if (v_nloaded == v_nimports) {
! f_main();
! }
! });
; DisableJS
EndProcedure
Procedure ExternalLoaded(URL$, Success)
;Static nLoaded
Debug "entrou"
If Success
nLoaded + 1
If nLoaded = nImports ; the number of files to import
Main()
EndIf
Else
Debug "Failed to load external: " + URL$
EndIf
EndProcedure
; LoadScript("https://cdn.plyr.io/3.6.8/plyr.polyfilled.js", @ExternalLoaded(), #PB_Script_JavaScript)
RequireScript("https://cdn.plyr.io/3.6.8/plyr.polyfilled.js", "Plyr")
LoadScript("https://cdn.plyr.io/3.6.3/plyr.css", @ExternalLoaded(), #PB_Script_CSS)
LoadScript("https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css", @ExternalLoaded(), #PB_Script_CSS)
LoadScript("https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js", @ExternalLoaded(), #PB_Script_JavaScript)
show this errors :
https://prnt.sc/15a7bqz
why does this occur?
-
Peter
- Posts: 1093
- Joined: Mon Feb 24, 2014 10:17 pm
- Location: 127.0.0.1:9080
-
Contact:
Post
by Peter »
Always try to reduce the code to the bare minimum in case of problems. This works for me:
Code: Select all
Procedure Main()
! $("body").append("<div id='player' data-plyr-provider='youtube' data-plyr-embed-id='bTqVqk7FSmY'></div>");
! const player = new Plyr('#player', {});
! window.player = player;
EndProcedure
Global nImports = 2
Procedure ExternalLoaded(URL$, Success)
Static nLoaded
Debug "entrou"
If Success
nLoaded + 1
If nLoaded = nImports ; the number of files to import
Main()
EndIf
Else
Debug "Failed to load external: " + URL$
EndIf
EndProcedure
! define = null;
LoadScript("https://cdn.plyr.io/3.6.8/plyr.js", @ExternalLoaded(), #PB_Script_JavaScript)
LoadScript("https://cdn.plyr.io/3.6.3/plyr.css", @ExternalLoaded(), #PB_Script_CSS)
-
skinkairewalker
- Posts: 120
- Joined: Tue Jun 14, 2016 7:17 pm
Post
by skinkairewalker »
works fine !!!
you are the man, Peter!
but I solved it, just adding the
what would >
?
full code :
Code: Select all
Procedure AppendHead(content.s)
Debug "head"
!$("head").append(v_content);
EndProcedure
Procedure AppendBody(content.s)
!$("body").append(v_content);
EndProcedure
Procedure AppendContent(component.i,content.s, Position = #PB_Ignore)
GID = GadgetID(component)
If Position <> #PB_Ignore
! $(".card:eq(" + v_position + ")").prepend(v_content);
Else
! $(v_gid.div).append(v_content);
EndIf
EndProcedure
Procedure Main()
AppendBody("<div id='player' data-plyr-provider='youtube' data-plyr-embed-id='bTqVqk7FSmY'></div>")
!const player = new Plyr('#player', {});
!window.player = player;
EndProcedure
Global nLoaded
Global nImports = 4
Procedure ExternalLoaded(URL$, Success)
;Static nLoaded
Debug "entrou"
If Success
nLoaded + 1
If nLoaded = nImports ; the number of files to import
Main()
EndIf
Else
Debug "Failed to load external: " + URL$
EndIf
EndProcedure
; just add this line below
! define = null;
LoadScript("https://cdn.plyr.io/3.6.8/plyr.js", @ExternalLoaded(), #PB_Script_JavaScript)
LoadScript("https://cdn.plyr.io/3.6.3/plyr.css", @ExternalLoaded(), #PB_Script_CSS)
LoadScript("https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css", @ExternalLoaded(), #PB_Script_CSS)
LoadScript("https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js", @ExternalLoaded(), #PB_Script_JavaScript)