Liquidsoap play news once every hour - liquidsoap

I have an internet radio playing a playlist.
The stream is managed by Liquidsoap. How can I make it play once news in every hour?
If I set a 0m0s-4m0s interval in switch and the track playing before the news finishes at x o'clock 1 minute and the news is 2 minutes long then it plays twice because the end of the news is still in the 0m0s-4m0s interval. I have tried the add function, but it resulted in playing both the news and music in the same time. If I just specify the start time rather than an interval then news is not going to be played if a track is still playing at the start time. I've also tried to put news into a playlist.once source and it worked, but it did not play next time.
Thanks for help in advance and sorry for my bad english.
I post the current code below:
news = playlist.once("/professzor/dj/playlists/newsplist.m3u")
radio = fallback([switch([({0m0s-4m0s},news)]), pl, single("/professzor/dj/beep.wav")])

Related

Using hls.js to play a live stream with a rolling live window, how do you keep captions in webvtt aligned?

I can play a live stream with the hls.js player using playlists master.m3u8, video.m3u8 and metadata.m3u8. The video is created using ffmpeg hls commands and is using a rolling live window with the args:
-hls_list_size 20 -hls_time 2 -hls_flags delete_segments
This creates video fragments starting with video0.ts to video19.ts, then starts removing the first fragments as it adds new ones. The video.m3u8 eventually looks like...
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:25
#EXTINF:2.002133,
video25.ts
#EXTINF:2.002133,
video26.ts
...
My metadata.m3u8 playlist looks similar though I am creating that from a separate source. The video and metadata playlist are kept in sync and play fine from the start of my live.
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:25
#EXTINF:2.000
sub_25.vtt
#EXTINF:2.000
sub_26.vtt
...
The problem starts when I reload the player page. On a reload, the player loads the playlists and will play correctly at the current live point.
I see it load fragments around video45.ts and sub_45.vtt. This is seemingly correct as the media sequence in video.m3u8 is at 25. Add in the 20 fragment playlist size and the live position is around 45th fragment. This is around 90 seconds into the live.
However, the media time in the player shows 40 seconds. It seems to use the number of fragments in the playlist only to come up with 40 seconds, even though the real live time is 90 seconds.
The final resulting problem is that the 40 second media time is being used to reference the text track cues and showing captions for 40 seconds.. not 90 seconds mark where the video actually is from.
Is there a way to get the player to correctly reflect the 'real' time, despite the rolling window of live, so the captions (which are correctly loaded) to display at the correct time?
Or is the rolling window live playback not going to work with subtitles in vtt?
If I disable the rolling window support I can reload the live many times and the 'full' live time loads and the captions line up ok.

How to get current elapsed time of iPhone music player?

This is a seemingly simple question that I just can't seem to find a simple answer for.
To rephrase the question: I want to get the current time stamp on a song playing on the native music player on an iPhone from my separate app.
I've seen the rich set of commands possible with MPMediaItemProperty but it seems nothing quite fits the bill.
MPMediaItemPropertyPlaybackDuration is close, but I believe this returns the total length of the currently playing song.
Any help is appreciated!
Matt
I believe you're looking for -[MPMusicPlayerController currentPlaybackTime];. This value returns the current position of the playhead, or rather the elapsed time in the currently playing track.
NSTimeInterval interval = [[MPMusicPlayerController iPodMusicPlayer] currentPlaybackTime];

seek to time in AVQueuePlayer

Merged with seek to time in AVQueuePlayer.
Can any one help me to seek at particular time in AVQueuePlayer,
I have use this controller to play video in iPhone because i need to play two video at the same time.
But my problem is to navigate in video and jump to at particular time , I am not able to do that.
I Know the method the That is [controller seekToTime:(CMTime)], But it is not moving the video at exact position of the video.
Can any one know the solution and have sample code then please reply me . I am try to solve this problem since last week,
Thanks in advance

set seek time in AVQueuePlayer in iphone

I am developing an application in that I want to play two video at the same time, That is not possible using MPMoviePlayer. So I have used AVQueuePlayer To play video. As I am success to play video but the problem is in jumping to particular time. For that we have method call seekToTime and we need to variable of the CMTime datatype.
I am able to jump at time in 1,2,3 seconds etc, My problem that I want to jump at Time 1.2, 1.3 , 1.4 second etc. but I am not able to move the video at that time.
Can any one know the solution of this problem than please help me to solve the problem.
The seekToTime: method, however, is tuned for performance rather than precision. If you need to move the playhead precisely, instead you use seekToTime:toleranceBefore:toleranceAfter Reference
toleranceBefore: The accuracy of the time before to which you would like to move the playback cursor.
[time-beforeTolerance]
toleranceAfter: The accuracy of the time after to which you would like to move the playback cursor.
[time+afterTolerance]
Lets say both parameters represents the margin of in-accuracy.
I have seen other Question on SO using self.player.currentItem.asset.duration to get the duration.
Good Luck.

AVAudioPlayer seek performance is not good

We are a developing an application which is supposed to play long audio files. duration of audio file can be upto 23 hours...
we are trying to use this AVAuidoPlayer for this purpose. To perform fast forward we are setting CurrentTime property of AVAudioPlayer. if the forward duration is just few minutes or even upto 20 minutes everything works fine. But if we try to jump by say 2 hours time then setCurrentTime call on the player take too long time ( almost 30-40 seconds). This is not acceptable behavior.
please let me know if anybody managed to successfully use AVAudioPlayer setCurrentTime property to jump long durations (say 2 hours)
What is the file format of your file?
I had this problem with MP3, it worked better with AAC.