here is way im adding player, i have no idea how to incorporate lyrics are the track duration feature as it is not clear in tutorials, please help (back story, ive created my own text to speech engine using ai, and im having ai convert ebooks to audio books and read them, i chose your player for the lyric feature and the ability for users to be able to read along while they listen. :
remove_filter( 'the_content', 'isermons_single_post_content' ); $post_id = get_the_ID(); // Fetching the post ID $audio_file_url = get_post_meta(get_the_ID(), 'isermons_audio_file', true); // Fetching the custom field value $featured_image_url = get_the_post_thumbnail_url(get_the_ID()); // Fetching the featured image URL $post_title = get_the_title(); // Fetching the post title $isermons_content_wrapper_start = '<div style="max-width: 1140px; margin: 0 auto"> <div class="isermons isermons-single"> [sonaar_audioplayer albums="' . $post_id . '" show_skip_bt="true" id="' . $post_id . '" player_layout="skin_boxed_tracklist" show_album_market="false" sticky_player="true" show_volume_bt="true" show_speed_bt="true" post_link="false" feed_title="' . $post_title . '" feed="' . $audio_file_url . '" feed_img="' . $featured_image_url . '" hide_artwork="false" show_playlist="false" show_track_market="true" show_meta_duration="true" show_album_market="true" hide_progressbar="false" hide_times="false" hide_track_title="true"][/sonaar_audioplayer] [sonaar_lyrics_placeholder][/sonaar_lyrics_placeholder] Chapter 01: [sonaar_ts time="0:35"]About this session #1 (00:35)[/sonaar_ts]<br> Chapter 02: [sonaar_ts time="10:43"]Learn something cool (10:43)[/sonaar_ts]<br> Chapter 03: [sonaar_ts time="20:00"]Mastermind is tricky (20:00)[/sonaar_ts]<br> Chapter 04: [sonaar_ts time="35:15"]Find your ways always (35:15)[/sonaar_ts]<br> '; $isermons_content_wrapper_end = '</div></div>'; return $isermons_content_wrapper_start.$isermons_content.$isermons_content_wrapper_end; }
You cannot use the feed="' . $audio_file_url param along with the lyrics.
Is there a reason why you don't use our custom fields for your audiobooks CPT instead of using a custom shortcode, as well as creating your player using Elementor ?
yes, with over 2000 audio books and growing, i cant create a short code for each one of them unfortunately as its just me and my part time developer creating this site
and as u see it all works, i just need the lyrics to appear, but the audio file works just fine
just need the duration and the lyrics, ill try to see how lyrics look after creating the short code in play list to see if theres a way as well
Ok, you know that you don't have to create 2000 different shortcodes, right? Just create your audio book single template with elementor pro, then add a widget play and choose 'Current Post' as the source to automatically feed the player with our custom fields from the dynamic posts.
so these posts are automatically created once ebook is imported with api, then ai automatiucally parses ebook to ssml, then after ssml is created it creates audio, so i am creating code for it to take audio and creates ttml
so ive never created an elementor template before, do you have any instructions for this? and im guessing this template will become the new post page for my custom post type?
ok i removed previous comments to make sure i went through everything, lyrics and duration no where to be found in elementor mode...
need a solution or a way to add to shortcode, or u can tell me where short code script is so i may add it myself. i dont know if it can be added via gutenburg that means its definitely set up just not via shortcode
also need to know a way to log via php when user click play and pause, and if there is away to capture the time stamp of the duration or current place in audio when they hit play and pause in the player. i know u provided javascrpt for the play button so i dont know whether i dont use the play button and add my own or what. thanks
if you want to benefits from the lyrics / duration feature we have, you must upload the lyrics directly in our custom fields: https://drops.sonaar.io/i/rWJFG8
In reply to this question: also need to know a way to log via php when user click play and pause, and if there is away to capture the time stamp of the duration or current place in audio when they hit play and pause in the player,
its not possible to capture timestamp of the duration of current place when hitting play. Perhaps you can use custom javascript for this but its not a feature we currently support.
thanks for responding, so ill answer each response 1 by 1.....
1) if you want to benefits from the lyrics / duration feature we have, you must upload the lyrics directly in our custom fields: https://drops.sonaar.io/i/rWJFG8 - (((((my quest )))))) so it seems still must go in and edit each post manually still since after creating template i have to add custom field? or maybe i can do that with how i was previously doing iust using php to add ttml and feed to each book. if that so maybe i have too look up the meta name for each custom field
2) Also, you cannot use the audio source / group rep (((((( okay i will remove this, i think i understand kind of now ))))
3) its not possible to capture timestamp of the duration of current place when hitting play. Perhaps you can use custom javascript for this but its not a feature we currently support. (((((( question: can you point me to the location of play button code or give me a hint, and i can use ai to give me code, in rturn ill provide it too you, maybe u can use it in next update)
i almost figured out how to do, i see in database u saved as serialized array.. so instead of track_1 and track_2, i just need to know the values of the fields so i can save my data there :) if not im still searching as well
so something like:
$mypostid = ...; // this be post id i think
// Tracklist data you want to save for the sermon. $tracklist_data = array( 'track_1' => 'Song Name 1', 'track_2' => 'Song Name 2', // ... and so on for the rest of the tracks. );
// Save the tracklist data. update_post_meta($sermon_id, 'alb_tracklist', $tracklist_data);
here is the code i created :) i just have to get the ttml file working correctly but for the most part its working.. final question how do i make duration work, its still not showing in player
is there anyway to start it on a faster speed? and can u give me a clue where in the plugin to find the java for the play button so i can i add a code to timestamp position on play, pause and comment similar to sound cloud
function update_alb_tracklist_meta() { // Make sure user is logged in and we are on the right post type if (!is_user_logged_in() || get_post_type() !== 'imi_isermons') { return; }
// If any of the specified keys are empty, delete the meta entry if (!empty($alb_tracklist)) { $keys_to_check = [ 'FileOrStream', 'stream_link', 'stream_title', 'stream_album', 'artist_name', 'stream_lenght', 'track_description', 'track_lyrics_id', 'track_lyrics' ];
foreach ($keys_to_check as $key) { if (empty($alb_tracklist[0][$key])) { delete_post_meta($post_id, 'alb_tracklist'); break; } } }
// Fetch values to update $stream_link = get_post_meta($post_id, 'isermons_audio_file', true); // Convert relative URL to full URL for stream_link if (!filter_var($stream_link, FILTER_VALIDATE_URL)) { $stream_link = home_url($stream_link); } $stream_title = get_the_title($post_id); $stream_lenght = get_post_meta($post_id, 'isermons_audio_length', true); $track_lyrics_id = get_post_meta($post_id, 'book_ttmlid', true) ?: $post_id; $track_lyrics = get_post_meta($post_id, 'book_ttml', true); // Convert relative URL to full URL for track_lyrics if (!filter_var($track_lyrics, FILTER_VALIDATE_URL)) { $track_lyrics = home_url($track_lyrics); }
// Set up new values $new_tracklist_data = [ 'FileOrStream' => 'stream', 'stream_link' => $stream_link, 'stream_title' => htmlspecialchars($stream_title, ENT_QUOTES, 'UTF-8'), // Sanitize title 'stream_album' => 'ReadPanda.ai', 'artist_name' => '---', 'stream_lenght' => $stream_lenght, 'track_description' => 'The Future of Audiobooks', 'track_lyrics_id' => $track_lyrics_id, 'track_lyrics' => $track_lyrics ];
// Update post meta update_post_meta($post_id, 'alb_tracklist', [$new_tracklist_data]);
// Error handling (if required) // Note: WordPress functions usually return false on failure. Adjust if you have additional requirements. if (false === update_post_meta($post_id, 'alb_tracklist', [$new_tracklist_data])) { $admin_email = get_option('admin_email'); if ($admin_email) { wp_mail($admin_email, 'Error Updating Meta', 'Failed to update alb_tracklist for post ID: ' . $post_id); } } }
For the faster speed, it depends on your server speed to process and load the file..nothing we can do about this.
All our JS code are located in iron-audioplayer.js for the widget player and in sonaarplayer.js for the sticky player. We have multiple play buttons and functions. It might be relatively complex to add the feature you want
here is link to player:
https://readingpanda.ai/audiobook/the-next-step-in-religion-an-essay-toward-the-coming-renaissance/
here is way im adding player, i have no idea how to incorporate lyrics are the track duration feature as it is not clear in tutorials, please help
(back story, ive created my own text to speech engine using ai, and im having ai convert ebooks to audio books and read them, i chose your player for the lyric feature and the ability for users to be able to read along while they listen.
:
remove_filter( 'the_content', 'isermons_single_post_content' );
$post_id = get_the_ID(); // Fetching the post ID
$audio_file_url = get_post_meta(get_the_ID(), 'isermons_audio_file', true); // Fetching the custom field value
$featured_image_url = get_the_post_thumbnail_url(get_the_ID()); // Fetching the featured image URL
$post_title = get_the_title(); // Fetching the post title
$isermons_content_wrapper_start = '<div style="max-width: 1140px; margin: 0 auto">
<div class="isermons isermons-single">
[sonaar_audioplayer albums="' . $post_id . '" show_skip_bt="true" id="' . $post_id . '" player_layout="skin_boxed_tracklist" show_album_market="false" sticky_player="true" show_volume_bt="true" show_speed_bt="true" post_link="false" feed_title="' . $post_title . '" feed="' . $audio_file_url . '" feed_img="' . $featured_image_url . '" hide_artwork="false" show_playlist="false" show_track_market="true" show_meta_duration="true" show_album_market="true" hide_progressbar="false" hide_times="false" hide_track_title="true"][/sonaar_audioplayer]
[sonaar_lyrics_placeholder][/sonaar_lyrics_placeholder]
Chapter 01: [sonaar_ts time="0:35"]About this session #1 (00:35)[/sonaar_ts]<br>
Chapter 02: [sonaar_ts time="10:43"]Learn something cool (10:43)[/sonaar_ts]<br>
Chapter 03: [sonaar_ts time="20:00"]Mastermind is tricky (20:00)[/sonaar_ts]<br>
Chapter 04: [sonaar_ts time="35:15"]Find your ways always (35:15)[/sonaar_ts]<br>
';
$isermons_content_wrapper_end = '</div></div>';
return $isermons_content_wrapper_start.$isermons_content.$isermons_content_wrapper_end;
}
Hi,
the lyrics feature is currently supported only if its inputed through our custom fields: https://drops.sonaar.io/i/rWJFG8
You cannot use the feed="' . $audio_file_url param along with the lyrics.
Is there a reason why you don't use our custom fields for your audiobooks CPT instead of using a custom shortcode, as well as creating your player using Elementor ?
Thanks,
Max from the Sonaar.io Crew
yes, with over 2000 audio books and growing, i cant create a short code for each one of them unfortunately as its just me and my part time developer creating this site
and as u see it all works, i just need the lyrics to appear, but the audio file works just fine
just need the duration and the lyrics, ill try to see how lyrics look after creating the short code in play list to see if theres a way as well
Ok, you know that you don't have to create 2000 different shortcodes, right? Just create your audio book single template with elementor pro, then add a widget play and choose 'Current Post' as the source to automatically feed the player with our custom fields from the dynamic posts.
Thanks,
Max from the Sonaar.io Crew
so these posts are automatically created once ebook is imported with api, then ai automatiucally parses ebook to ssml, then after ssml is created it creates audio, so i am creating code for it to take audio and creates ttml
so ive never created an elementor template before, do you have any instructions for this?
and im guessing this template will become the new post page for my custom post type?
Yes. https://elementor.com/help/creating-a-single-post-template-with-elementor-pro/#:~:text=Under%20Templates%20%3E%20Add%20New%2C%20from,the%20preview%20example%20while%20editing.
Thanks,
Max from the Sonaar.io Crew
ok i removed previous comments to make sure i went through everything, lyrics and duration no where to be found in elementor mode...
need a solution or a way to add to shortcode, or u can tell me where short code script is so i may add it myself. i dont know if it can be added via gutenburg that means its definitely set up just not via shortcode
also need to know a way to log via php when user click play and pause, and if there is away to capture the time stamp of the duration or current place in audio when they hit play and pause in the player. i know u provided javascrpt for the play button so i dont know whether i dont use the play button and add my own or what. thanks
Hi,
if you want to benefits from the lyrics / duration feature we have, you must upload the lyrics directly in our custom fields: https://drops.sonaar.io/i/rWJFG8
Also, you cannot use the audio source / group repeater meta keys: https://drops.sonaar.io/i/1w1t5I
Using our custom fields are mandatory to make the lyric feature works.
Thanks,
Max from the Sonaar.io Crew
In reply to this question: also need to know a way to log via php when user click play and pause, and if there is away to capture the time stamp of the duration or current place in audio when they hit play and pause in the player,
its not possible to capture timestamp of the duration of current place when hitting play. Perhaps you can use custom javascript for this but its not a feature we currently support.
Thanks,
Max from the Sonaar.io Crew
thanks for responding, so ill answer each response 1 by 1.....
1) if you want to benefits from the lyrics / duration feature we have, you must upload the lyrics directly in our custom fields: https://drops.sonaar.io/i/rWJFG8 - (((((my quest )))))) so it seems still must go in and edit each post manually still since after creating template i have to add custom field? or maybe i can do that with how i was previously doing iust using php to add ttml and feed to each book. if that so maybe i have too look up the meta name for each custom field
2) Also, you cannot use the audio source / group rep (((((( okay i will remove this, i think i understand kind of now ))))
3) its not possible to capture timestamp of the duration of current place when hitting play. Perhaps you can use custom javascript for this but its not a feature we currently support. (((((( question: can you point me to the location of play button code or give me a hint, and i can use ai to give me code, in rturn ill provide it too you, maybe u can use it in next update)
i almost figured out how to do, i see in database u saved as serialized array.. so instead of track_1 and track_2, i just need to know the values of the fields so i can save my data there :) if not im still searching as well
so something like:
$mypostid = ...; // this be post id i think
// Tracklist data you want to save for the sermon.
$tracklist_data = array(
'track_1' => 'Song Name 1',
'track_2' => 'Song Name 2',
// ... and so on for the rest of the tracks.
);
// Save the tracklist data.
update_post_meta($sermon_id, 'alb_tracklist', $tracklist_data);
ok i have found :) now we can get some where, ill will write out code now and send u link if i get it to work with lyrics
The pairs are:
Great!
Thanks,
Max from the Sonaar.io Crew
here is the code i created :) i just have to get the ttml file working correctly but for the most part its working..
final question how do i make duration work, its still not showing in player
https://readingpanda.ai/audiobook/niobe-all-smiles-a-farcical-comedy-in-three-acts/
is there anyway to start it on a faster speed? and can u give me a clue where in the plugin to find the java for the play button so i can i add a code to timestamp position on play, pause and comment similar to sound cloud
---------------------------------------------------------------------------------------------------------------------------------------------------
add_action('template_redirect', 'update_alb_tracklist_meta');
function update_alb_tracklist_meta() {
// Make sure user is logged in and we are on the right post type
if (!is_user_logged_in() || get_post_type() !== 'imi_isermons') {
return;
}
$post_id = get_the_ID();
$alb_tracklist = get_post_meta($post_id, 'alb_tracklist', true);
// If any of the specified keys are empty, delete the meta entry
if (!empty($alb_tracklist)) {
$keys_to_check = [
'FileOrStream', 'stream_link', 'stream_title', 'stream_album',
'artist_name', 'stream_lenght', 'track_description', 'track_lyrics_id', 'track_lyrics'
];
foreach ($keys_to_check as $key) {
if (empty($alb_tracklist[0][$key])) {
delete_post_meta($post_id, 'alb_tracklist');
break;
}
}
}
// Fetch values to update
$stream_link = get_post_meta($post_id, 'isermons_audio_file', true);
// Convert relative URL to full URL for stream_link
if (!filter_var($stream_link, FILTER_VALIDATE_URL)) {
$stream_link = home_url($stream_link);
}
$stream_title = get_the_title($post_id);
$stream_lenght = get_post_meta($post_id, 'isermons_audio_length', true);
$track_lyrics_id = get_post_meta($post_id, 'book_ttmlid', true) ?: $post_id;
$track_lyrics = get_post_meta($post_id, 'book_ttml', true);
// Convert relative URL to full URL for track_lyrics
if (!filter_var($track_lyrics, FILTER_VALIDATE_URL)) {
$track_lyrics = home_url($track_lyrics);
}
// Set up new values
$new_tracklist_data = [
'FileOrStream' => 'stream',
'stream_link' => $stream_link,
'stream_title' => htmlspecialchars($stream_title, ENT_QUOTES, 'UTF-8'), // Sanitize title
'stream_album' => 'ReadPanda.ai',
'artist_name' => '---',
'stream_lenght' => $stream_lenght,
'track_description' => 'The Future of Audiobooks',
'track_lyrics_id' => $track_lyrics_id,
'track_lyrics' => $track_lyrics
];
// Update post meta
update_post_meta($post_id, 'alb_tracklist', [$new_tracklist_data]);
// Error handling (if required)
// Note: WordPress functions usually return false on failure. Adjust if you have additional requirements.
if (false === update_post_meta($post_id, 'alb_tracklist', [$new_tracklist_data])) {
$admin_email = get_option('admin_email');
if ($admin_email) {
wp_mail($admin_email, 'Error Updating Meta', 'Failed to update alb_tracklist for post ID: ' . $post_id);
}
}
}
About the duration, I can see it here: https://drops.sonaar.io/i/uewor1
please elaborate what duration does not show ?
For the faster speed, it depends on your server speed to process and load the file..nothing we can do about this.
All our JS code are located in iron-audioplayer.js for the widget player and in sonaarplayer.js for the sticky player. We have multiple play buttons and functions. It might be relatively complex to add the feature you want
Thanks,
Max from the Sonaar.io Crew