VNMediaClientNET

MediaReciever.h
1 #pragma once
2 #include "vn_player.h"
3
4 class JsonObjectsTracker;
5 #include <string>
6 #include <map>
7 #include <vector>
8
12 namespace VideoNext
13 {
14 using namespace System;
15 using namespace System::Collections::Generic;
16
17 class NativeMediaReciever;
18 interface class INativeMediaRecieverSink;
19 ref class StreamStateEventArgs;
20 ref class VideoFrameEventArgs;
21 ref class CacheBoundariesEventArgs;
22 ref class MessageLogEventArgs;
23 ref class StreamEventArgs;
24 ref class RecordingStatusEventArgs;
25
29 public ref class MediaReciever : INativeMediaRecieverSink,
30 public IDisposable
31 {
32 public:
44 MediaReciever(DecoderType decoderType, Int32 cacheSizeMegabytes, RtpTransport rtpTransport, PixelFormat pixelFormat, Int32 bufferLength);
45
49 ~MediaReciever();
50
51 public:
57 void Play(String^ url);
58
62 void Pause();
63
69 void Resume(PlaybackDirection direction);
70
75 void SetPlaybackSpeed(Double speed);
76
82 void GotoTime(DateTime time);
83
90 bool StartRecording(String^ filename, Dictionary<String^, String^>^ metadata);
91
97 bool EndRecording();
98
103 property StreamState State
104 {
105 StreamState get()
106 {
107 return m_nativeMediaReciever != nullptr ? (StreamState)(int)(m_nativeMediaReciever->GetState()) : StreamState::Idle;
108 }
109 };
110
114 property bool IsPaused
115 {
116 bool get()
117 {
118 return m_nativeMediaReciever != nullptr && m_nativeMediaReciever->IsPaused();
119 }
120 };
121
125 property bool IsPlaying
126 {
127 bool get()
128 {
129 return m_nativeMediaReciever != nullptr && m_nativeMediaReciever->IsPlaying();
130 }
131 };
132
139 static bool IsPlayingState(StreamState state);
140
145 event EventHandler<VideoFrameEventArgs^> ^OnVideoFrame;
146
151 event EventHandler<StreamStateEventArgs^> ^OnStreamState;
152
157 event EventHandler<CacheBoundariesEventArgs^> ^OnBufferBoundaries;
158
163 event EventHandler<MessageLogEventArgs^> ^OnMessageLog;
164
169 event EventHandler<StreamEventArgs^> ^OnStreamAdded;
170
175 event EventHandler<StreamEventArgs^> ^OnStreamDeleted;
176
181 event EventHandler<RecordingStatusEventArgs^> ^OnRecordingStatusChange;
182
183 protected:/* INativeMediaRecieverSink */
184 virtual void OnNewFrame(const vn_player_frame_t* frame, const vn_player_cache_boundaries_t* bounds) = INativeMediaRecieverSink::OnNewFrame;
185 virtual void OnBufferChanged(const vn_player_cache_boundaries_t* bounds) = INativeMediaRecieverSink::OnBufferChanged;
186 virtual void OnStateChanged(VN_PLAYER_STREAM_STATE state, const vn_player_result_status_t* result_status) = INativeMediaRecieverSink::OnStateChanged;
187 virtual void OnNewStream(const vn_player_stream_info_t* stream_info) = INativeMediaRecieverSink::OnNewStream;
188 virtual void OnStreamRemoved(const vn_player_stream_info_t* stream_info) = INativeMediaRecieverSink::OnStreamRemoved;
189 virtual void OnRecordingStatusChanged(const vn_player_recording_status_t* status) = INativeMediaRecieverSink::OnRecordingStatusChanged;
190 virtual void OnMsgLog(const char* message) = INativeMediaRecieverSink::OnMsgLog;
191 private:
192 static Int64 ToUnixTime(DateTime date);
193 static DateTime ToClrTime(long unixTime);
194 private:
195 NativeMediaReciever *m_nativeMediaReciever;
196 Object ^m_criticalSection;
197 Boolean m_hasPlayed;
198 AnalyticsRenderer^ m_analyticsRenderer;
199 JsonObjectsTracker *m_jsonObjectsTracker;
200 };
201 }
VideoNext::StreamState::Idle
@ Idle
VideoNext::AnalyticsRenderer
Definition: AnalyticsRenderer.h:9
VideoNext::PixelFormat
PixelFormat
Pixel format.
Definition: Enums.h:43
VideoNext::MediaReciever::OnBufferBoundaries
event EventHandler< CacheBoundariesEventArgs^> OnBufferBoundaries
Event is invoked when player cache boundaries changed.
Definition: MediaReciever.h:157
JsonObjectsTracker
Definition: JsonObjectsTracker.h:37
VideoNext::DecoderType
DecoderType
Decoder type.
Definition: Enums.h:54
VideoNext::MediaReciever::OnRecordingStatusChange
event EventHandler< RecordingStatusEventArgs^> OnRecordingStatusChange
Event is invoked when recording to a file status changed.
Definition: MediaReciever.h:181
VideoNext
VideoNEXT media player API.
Definition: AnalyticsRenderer.cpp:7
VideoNext::MediaReciever::OnStreamAdded
event EventHandler< StreamEventArgs^> OnStreamAdded
Event is invoked when a video stream added. Can be used to get video info for any type of source and ...
Definition: MediaReciever.h:169
VideoNext::PlaybackDirection
PlaybackDirection
Playback direction.
Definition: Enums.h:25
VideoNext::MediaReciever
Managed wrapper for VideoNEXT media player.
Definition: MediaReciever.h:31
VideoNext::MediaReciever::OnVideoFrame
event EventHandler< VideoFrameEventArgs^> OnVideoFrame
Event is invoked on new video frame arrived.
Definition: MediaReciever.h:145
VideoNext::MediaReciever::OnMessageLog
event EventHandler< MessageLogEventArgs^> OnMessageLog
Event is invoked on a new information message arrived from the player.
Definition: MediaReciever.h:163
VideoNext::NativeMediaReciever
Definition: NativeMediaReciever.h:12
VideoNext::MediaReciever::OnStreamState
event EventHandler< StreamStateEventArgs^> OnStreamState
Event is invoked when a player state changed.
Definition: MediaReciever.h:151
VideoNext::StreamState
StreamState
Media player state.
Definition: Enums.h:11
VideoNext::RtpTransport
RtpTransport
RTP transport.
Definition: Enums.h:34
VideoNext::INativeMediaRecieverSink
Definition: INativeMediaRecieverSink.h:7
VideoNext::MediaReciever::OnStreamDeleted
event EventHandler< StreamEventArgs^> OnStreamDeleted
Event is invoked when a video stream removed.
Definition: MediaReciever.h:175