# Deleting File When Someone Is Actively Playing Back

**URL:** <https://community.wowza.com/t/deleting-file-when-someone-is-actively-playing-back/36991>\
**Category:** Wowza Streaming Engine\
**Tags:** server-administration\
**Created:** [October 8, 2014, 3:33pm UTC](https://community.wowza.com/t/deleting-file-when-someone-is-actively-playing-back/36991 "2014-10-08T15:33:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Wall](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@Matthew\_Wall](https://community.wowza.com/u/Matthew_Wall)\
**Post date:** [October 8, 2014, 3:33pm UTC](https://community.wowza.com/t/deleting-file-when-someone-is-actively-playing-back/36991/1 "2014-10-08T15:33:38Z")

</div>

Hello,

I have an issue here with the latest version of Wowza ( I’m sure the earlier ones have this behavior too ). I’m running Windows Server 2012 R2 with the latest JDK installed.

We have various assets on a multi-tenant Wowza server and need to be able to rename, move or delete a file that is actively being streamed. We have a front-end that leverages APIs we built to manage the Wowza content for the customers. When our backend tries to delete a file we’re running into an issue where, often due to demand, there is always 1+ user engaging the file and streaming it. This leaves a file lock on the asset in Java. We’re not sure how to go about this in a way that:

1. Allows us to remove the file ( so the customer doesn’t get billed for disk usage )

2. Allows people watching the asset, ideally, to gracefully end playback ( perhaps when cached data on the stream runs out )

3. Does not cause issues with the data in the file ( in the case of moving or renaming ) and plays nice with Wowza / Java.

I appreciate any time and help anyone can offer us!

-Matthew

---

<div class="post-metadata">

**Author:** ![Emre\_Karatasoglu\_Adv](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@Emre\_Karatasoglu\_Adv](https://community.wowza.com/u/Emre_Karatasoglu_Adv)\
**Post date:** [October 9, 2014, 3:44pm UTC](https://community.wowza.com/t/deleting-file-when-someone-is-actively-playing-back/36991/2 "2014-10-09T15:44:28Z")

</div>

Hi Matthew , I guess, you can do it with HttpProvider Class and the application module.

When your clients start to play ( in http , rtmp , rtsp … ) add the client id and video name to the array list , map etc. Then

In httpProvider class develop a module that listen your call. When you call it with video name , then

get the video name and create an instance of your application module . Call the method that list active client id that watches this video .

Kill client connection with getting instance via getClientById , then client.rejectConnection() will work . After disconnecting you can easily move,delete or rename file.

> public void onHTTPRequest(IVHost inVhost, IHTTPRequest req, IHTTPResponse resp)
> 
> {
> 
> String queryStr = req.getQueryString();
> 
> Map\<String, String\> queryMap = HTTPUtils.splitQueryStr(queryStr);
> 
> if (queryMap.containsKey(“unlockVideo”))
> 
> {
> 
> killConnection kc = new killConnection();
> 
> kc.getClientByVideoName(queryMap.get(“unlockVideo”));
> 
> }
> 
> Emre Karataşoğlu
> 
> [http://letheasoftware.com](http://letheasoftware.com)
> 
> [http://emrekaratasoglu.com](http://emrekaratasoglu.com)

---

<div class="post-metadata">

**Author:** ![Matthew\_Wall](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@Matthew\_Wall](https://community.wowza.com/u/Matthew_Wall)\
**Post date:** [October 15, 2014, 9:04am UTC](https://community.wowza.com/t/deleting-file-when-someone-is-actively-playing-back/36991/3 "2014-10-15T09:04:09Z")

</div>

Thank you very much Emre, we will take this route. A life saver =)
