1313using Telegram . Native . Media ;
1414using Telegram . Navigation ;
1515using Telegram . Services ;
16+ using Telegram . Streams ;
1617using Telegram . Td . Api ;
1718
1819namespace Telegram . Common
1920{
20- public record VideoPresentation ( int SessionId , int FileId , int Duration ) ;
21+ public record VideoPresentation ( IClientService ClientService , File File , int Duration ) ;
2122
2223 public partial class VideoPreloader
2324 {
@@ -60,7 +61,7 @@ public void Load(IClientService clientService, File file, int duration)
6061 return ;
6162 }
6263
63- var presentation = new VideoPresentation ( clientService . SessionId , file . Id , duration ) ;
64+ var presentation = new VideoPresentation ( clientService , file , duration ) ;
6465
6566 _presenters [ token ] = presentation ;
6667 _workQueue . Push ( new WorkItem ( token , presentation ) ) ;
@@ -106,8 +107,6 @@ private void Work()
106107
107108 private void LoadCachedVideo ( WorkItem work )
108109 {
109- var token = 0L ;
110-
111110 var options = new AsyncMediaPlayerOptions
112111 {
113112 Mode = AsyncMediaPlayerMode . Video
@@ -122,12 +121,11 @@ void handler(AsyncMediaPlayer sender, AsyncMediaPlayerBufferingEventArgs e)
122121 player . Close ( ) ;
123122
124123 _presenters . TryRemove ( work . Token , out _ ) ;
125- MediaHttpServer . Stop ( ref token ) ;
126124 }
127125 }
128126
129127 player . Buffering += handler ;
130- player . Play ( MediaHttpServer . Start ( work . Presentation , ref token ) ) ;
128+ player . Play ( new RemoteFileSource ( work . Presentation . ClientService , work . Presentation . File , work . Presentation . Duration ) ) ;
131129 }
132130
133131 record WorkItem ( long Token , VideoPresentation Presentation ) ;
0 commit comments