Plugin Author
Ulrich
(@grapplerulrich)
You should be able to customize the url with the filter fp5_filter_video_src. You would only add the dynamic file name in the fields.
/**
* Define standard URL for videos
*/
function fp5_filter_video_src( $src, $format, $id ) {
return 'http://wowza-server-ip:1935/wowza/mp4:' . $src;
}
add_filter( 'fp5_filter_video_src', 'fp5_filter_video_src' );
Ulrich:
In which file would I add this snippet of code? I understand the concept of what to change. However, wouldn’t I need to update the plugin with this code each time your release and update? That is not a big issue but I have not seen a child plugin option yet which allows customization of plugins without loosing the customization after each update.
Ulrich:
The only issue with this modification in my situation is that I have VOD video files and live streams. So each link is different for the suffix and prefix of the link depending the format used by the site. So this code would need to be slightly different for each format used.
Plugin Author
Ulrich
(@grapplerulrich)
You can change the url depending on the format e.g.
/**
* Define standard URL for videos
*/
function fp5_filter_video_src( $src, $format, $id ) {
if ( 'video/mp4' == $format ) {
$src = 'http://wowza-server-ip:1935/wowza/mp4:' . $src;
}
return $src;
}
add_filter( 'fp5_filter_video_src', 'fp5_filter_video_src' );
There are five formats application/x-mpegurl, video/webm, video/mp4, video/ogg, video/flash that you check for.
You can add the snippet to the functions.php of your child theme. The code will not be removed when the plugin updates.
Ulrich:
I do not clearly see the syntax to append to the link after entering the file name. The example provided will work with the following link:
rtsp://wowza-server-ip:1935/wowza/mp4:dyn-video.mp4
However in the following example I need to append ‘/manifest.mpd’ to the end of the URL after the file name for the link to work properly.
http://wowza-server-ip:1935/wowza/mp4:dyn-video.mp4/manifest.mpd
Please provide the proper syntax to get the results desired. Does it matter where in the function.php file I add the snippet code?
Plugin Author
Ulrich
(@grapplerulrich)
Ok, I understand now. This is what you could use. You can add the snippet anywhere in functions.php. You just need to look that is not placed within another piece of code.
/**
* Define standard URL for videos
*/
function fp5_filter_video_src( $src, $format, $id ) {
if ( 'video/mp4' == $format ) {
$src = 'http://wowza-server-ip:1935/wowza/mp4:' . $src;
}
if ( 'application/x-mpegurl' == $format ) {
$src = 'http://wowza-server-ip::1935/wowza/mp4:' . $src . '/playlist.m3u8';
}
if ( 'video/webm' == $format ) {
$src = 'http://wowza-server-ip::1935/wowza/mp4:' . $src . '/manifest.mpd';
}
if ( 'video/flash' == $format ) {
$src = 'http://wowza-server-ip::1935/wowza/mp4:' . $src . '/manifest.f4m';
}
return $src;
}
add_filter( 'fp5_filter_video_src', 'fp5_filter_video_src', 10, 3 );
Ulrich:
I tried to implement this code on my demo site and got segment missing errors for $format and $id and it did not alter the URLs in the plugin as described.
Plugin Author
Ulrich
(@grapplerulrich)
Hey, I corrected the code above. It should work now.
Ulrich:
I did manage to get it working but I had to change the link so that the first character was a ‘/’ because some of the fields automatically add an ‘http://’ to the file name after submitting the change.