Comments (5)
Will I have any garbage collection issues?
Yes. Other internal objects (_stream
, _decoder
, _texture
, _updater
) will be leaked.
I'd recommend destroying the HapPlayer
component and recreate a new instance to open another file.
from klakhap.
I'm closing this issue now. Please feel free to reopen it for further problems.
from klakhap.
Thanks. Just thinking this would be a very useful feature.
And could I simply do the following?
`public void Open(string filePath, PathMode pathMode = PathMode.StreamingAssets)
{
if (_demuxer != null)
{
Debug.LogError("Stream has already been opened.");
//_stream, _decoder, _texture, _updater
_stream.Dispose();
_stream = null;
_decoder.Dispose();
_decoder = null;
UnityEngine.Object.Destroy( _texture );
_texture = null;
_updater.Dispose();
_updater = null;
_demuxer.Dispose();// new line
_demuxer = null; // new line
//return;
}
_filePath = filePath;
_pathMode = pathMode;
OpenInternal();
}`
from klakhap.
I think your modification is on the right track this time. Yes, it might be a useful feature, it needs extensive testing though.
from klakhap.
Thanks. Unfortunately even with above still memory leak(s)! Based on your suggestion am creating 2nd component on same GameObject as HapPlayer.
Testing and will post results.
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
namespace Klak.Hap{
public class DestroyHAP : MonoBehaviour
{
HapPlayer _hap;
public RenderTexture rt;
public void DestroyComponent()
{
if(GetComponent<HapPlayer>() != null){
Destroy(GetComponent<HapPlayer>());
}
}
public HapPlayer CreateComponent()
{
_hap = gameObject.AddComponent<HapPlayer>();
_hap.targetTexture= rt;
_hap.targetRenderer= GetComponent<MeshRenderer>();
return _hap;
}
}
}`
from klakhap.
Related Issues (20)
- Freeze with small video
- Feature request; audio playback HOT 4
- ArrayTypeMismatchException in ReaderThread happens sometimes HOT 9
- Can't open movie in streaming assets mode if the resolved file path contains chinese characters
- Hard drive activity time is always 100% HOT 1
- Video won't show in player HOT 3
- Feature Request: dropped frames or missed timing HOT 2
- 'event' could not be found (are you missing a using directive or an assembly reference?) HOT 2
- KlakHap.bundle is damaged and can't be opened
- No way to Stop or Play video HOT 2
- I want to know the exact frame of the playing video.
- Android port HOT 5
- Hap player throws error when on iOS but not on PC HOT 1
- Doesn't work in HDRP builds? HOT 5
- question exe not showing video - thanks HOT 2
- Stutter when using the Unity Recorder @ 25 FPS HOT 6
- Turn off Texture Compression? HOT 3
- KlakHap and WebGL HOT 1
- filePath inaccessible HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from klakhap.