video Seek time not working

I am playing pre and mid roll ads in my video. i set mid roll ad interval of 5 min (300 seconds)
after playing the mid-roll ads, instead of showing video from 301 seconds onward, it shows from 0 seconds, i providing the time correctly, but do not know what going one

Explanation
i increment the variable “video_playback_time” and “ad_frequency_count” by each second. when “ad_frequency_count” i is greaten than equal to ad interval,
i play the mid-roll ads, then reset the “ad_frequency_count” to zero, once ads is complete, i am showing same video by providing “video_playback_time” in seconds.
In “get_video_object” function i am converting seek time into milliseconds.
video.Seek (seek_time * 1000) 'providing time in milliseconds


   '**************************************************************
    Function get_video_object (content_info, port, seek_time = 0)  
        
        video = CreateObject("roVideoScreen")
        video.SetPositionNotificationPeriod (1)
        video.SetContent (content_info)
        video.SetCGMS (4)
        video.SetMessagePort (port)
        video.Seek (seek_time * 1000) 'providing time in miliseconds
        video.Show ()
        return video
    End Function
    
    
    Function displayVideo(mainMenu as integer,subMenu as integer,isFeatured as integer)
        print "---displayVideo---"
        
        m.adsEnabled        = true
        m.ad_interval_sec   = 300
            
        if (m.BitRate = Invalid) then
           m.BitRate = 800
        end if
        
        if (m.BitRate.toInt() > 900) then
           m.BitRate = 900
        end if
        
        url = m.url + "?roku_device_id=" + m.device_id
    
        port      = CreateObject("roMessagePort")
        videoclip = CreateObject("roAssociativeArray")
    
        if (m.download_url = "" or m.download_url = Invalid) then
            url = m.url + "?roku_device_id=" + m.device_id
            videoclip.StreamFormat  = "hls"
            urls                    = m.Url
            videoclip.StreamUrls    = [url]
        else
            url                     = m.download_url
            videoclip.StreamFormat  = "mp4"
            videoclip.StreamUrls    = [url]
        end if
    
        videoclip.SDBifUrl        = m.bif_sd_url
        videoclip.HDBifUrl        = m.bif_hd_url
        videoclip.StreamQualities = ["SD"]
        videoclip.minBandwidth    = 10
        videoclip.StreamBitrates  = [m.BitRate]
        videoclip.SDBifUrl        = m.bif_sd_url
        videoclip.HDBifUrl        = m.bif_hd_url
        
        REM Show Preroll
        if m.adsEnabled then
            canvas = show_canvas (port)
            show_ad (port)
            ad_frequency_count = 0
        end if
    
        REM Show video
        video_playback_time = 0
        video = get_video_object (videoclip, port)   
    
        if m.url <> "NOURL" then
            while true
                msg = wait(0, port)
                if type (msg) = "roVideoScreenEvent" then
                    if msg.isScreenClosed () then
                        print "screen closed"
                        exit while
                    else if msg.isStreamStarted () then 
                        print msg.GetMessage ()
                        if m.adsEnabled then
                            canvas.SetLayer (1, {color: "#00000000", CompositionMode: "Source"})
                        end if
                    else if msg.isPlaybackPosition () then 
                        video_playback_time = video_playback_time + 1
                        REM Play midroll every ad_interval_sec
                        
                        if m.adsEnabled and ad_frequency_count >= m.ad_interval_sec then
                            ad_frequency_count = 0
                            video.Close ()
                            print "starting midroll ad"
                            show_ad (port)
                            print "after midroll ad"
                            canvas = show_canvas (port)
                            video  = get_video_object (videoclip, port, video_playback_time )
                            video.SetDestinationRect (canvas.GetCanvasRect ())
                        end if
                        if m.adsEnabled
                            ad_frequency_count = ad_frequency_count + 1
                        end if
                    end if 
                end if
            end while
        end if
    End Function

I don’t remember for sure, but you may have to call Seek() after Show() or even after playback starts.

For mid-rolls, a better approach might be to use the playStart attribute of your content-meta-data instead of Seek().

Solved this seek time issue for providing time in

videoclip.PlayStart = seekTime 

where seekTime in seconds rather than in mili-seconds

Sunil