Foliovision › Forums › FV Player › How to … › Shortcode – Use FV Player LearnDash with custom code
-
Greetings,
I’m excited to see FV player integrated with LearnDash Progress option!
I was wondering, is it possible to use the shortcode as an option instead of selecting a video directly for the settings to allow video progression?
Reason: I’ve developed a template and embedded the FV player to play a file from a custom field and would like to benefit from the progression feature. Can you advise on if this is possible at the moment?
Thanks
Regards,
Kendell
-
-
Hello Kendell,
thank you for the question! We are glad to see that the LearnDash integration helps so many of our users.
Sadly, using just shortcodes will not work. However, you can continue using shortcodes if you add embed][/embed] infront of it. Like this:
[embed][/embed][fvplayer id="1"]
Let me know, if it works for you.
Thanks,
MariaHello Kendell,
are you using FV_Player_MetaBox? This is how we register that for LearnDash:
if( class_exists('\FV_Player_MetaBox') ) { new \FV_Player_MetaBox( array( 'name' => 'FV Player', 'meta_key' => 'lesson_fv_player', 'post_type' => 'sfwd-lessons', 'display' => false, 'multiple' => false ) ); new \FV_Player_MetaBox( array( 'name' => 'FV Player', 'meta_key' => 'lesson_fv_player', 'post_type' => 'sfwd-topic', 'display' => false, 'multiple' => false ) ); }
If you do something similar you could try to change your key to the lesson_fv_player as seen above and then update the database entries.
Then once you save the lesson it should be used for the video progression.
The downside is that the display would be limited to what LearnDash has built-in.
The problem is that LearnDash LMS does use some HTML markup which has to be present on the player which is used for video progression and also some JavaScript globals. It was not easy to create this integration.
Thanks,
MartinHello Kendell,
we added a feature which lets you put in [fvplayer] shortcode into that LearnDash Video URL field and then it gets saved into that more fancy field with preview.
Please reinstall FV Player from this link to get the fixed version: https://github.com/foliovision/fv-wordpress-flowplayer/archive/master.zip
To do that you will have to first deactivate and delete the current FV Player plugin you are using. WordPress will warn you that you might loose settings and data, but it’s not the case with our plugin, no settings now videos will be lost. Or you can just replace the plugin files via FTP.
Thanks,
MartinHi Martin,
Thanks for your pursuit on this.
I believe my setup is a bit different from what you are explaining.
I have created a custom field where I upload .mp4 files that is then offloaded to my video host.
As a result I have created a template in which link of the video is passed to the shortcode dynamically. This is what the sample shortcode looks like:
[fvplayer splash="https://domain.com/filename.jpg" src="https://domain.com/filename.mp4" qsel="true" width="100%" height="100%" autoplay="false" speed="buttons"]
Do you need me to send a quick video or so showing my setup?
Hello Kendell,
as I was mentioning LearnDash LMS does use some HTML markup which has to be present on the player for it to work with the video progression.
The shortcode has to be in the LearnDash Video URL field, otherwise it does now work.
In your case you could perhaps store the resulting shortcode in their post meta field or put it these using WordPress filter get_post_metadata for the _sfwd-lessons and _sfwd-topic meta keys. The actual video URL is stored as sfwd-lessons_lesson_video_url or sfwd-topic_lesson_video_url key in the meta value array.
It took us a while to figure it out, you won’t find that in any LearnDash LMS docs.
Thanks,
Martin