Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added ability to store in directories

  • Loading branch information...
commit 7a33bb1701552d003a2b5ad3f2a17b8ef8e717f2 1 parent 46ed782
@maxlapshin maxlapshin authored
Showing with 4 additions and 1 deletion.
  1. +1 −0  src/media/media_provider.erl
  2. +3 −1 src/media/stream_media.erl
View
1  src/media/media_provider.erl
@@ -133,6 +133,7 @@ open_media_entry({Name, Type}, #media_provider{opened_media = OpenedMedia} = Med
undefined ->
case ems_sup:start_media(Name, Type) of
{ok, Pid} ->
+ ?D({"ZZZ:", Type, Pid}),
link(Pid),
ets:insert(OpenedMedia, #media_entry{name = Name, handler = Pid}),
?D({"Opened", Type, Name, Pid}),
View
4 src/media/stream_media.erl
@@ -57,6 +57,7 @@ init([Name, record]) ->
Clients = ets:new(clients, [set, private]),
FileName = filename:join([file_play:file_dir(), Name ++ ".flv"]),
(catch file:delete(FileName)),
+ ok = filelib:ensure_dir(FileName),
Header = flv:header(#flv_header{version = 1, audio = 1, video = 1}),
?D({"Recording to file", FileName}),
case file:open(FileName, [write, {delayed_write, 1024, 50}]) of
@@ -65,6 +66,7 @@ init([Name, record]) ->
Recorder = #media_info{type=record, device = Device, file_name = FileName, ts_prev = 0, clients = Clients},
{ok, Recorder, ?TIMEOUT};
_Error ->
+ error_logger:error_msg("Failed to start recording stream to ~p because of ~p", [FileName, _Error]),
ignore
end.
@@ -120,7 +122,7 @@ handle_call({set_owner, _Owner}, _From, #media_info{owner = Owner} = MediaInfo)
handle_call({publish, Channel}, _From, #media_info{device = Device, clients = Clients} = Recorder) ->
Tag = ems_flv:to_tag(Channel),
- ?D({"Record",Channel#channel.type, Channel#channel.timestamp}),
+ % ?D({"Record",Channel#channel.type, Channel#channel.timestamp}),
case Device of
undefined -> ok;
_ -> file:write(Device, Tag)
Please sign in to comment.
Something went wrong with that request. Please try again.