fix issue naming in nameddepthkitplayer causing a crash

btc_debug
rspoerri 2024-03-18 21:06:14 +01:00
parent 13eacfaca7
commit 6e9b67cfb8
1 changed files with 24 additions and 4 deletions

View File

@ -30,16 +30,36 @@ public class NamedDepthkitPlayer : ComponentHandler {
public override string ContentLabel() {
UpdateComponent();
string filename = depthkitClip.metadataFilePath;
if (depthkitClip.metadataSourceType == MetadataSourceType.TextAsset) {
filename = depthkitClip.metadataFile.name;
// string filename = "dummy-metadatafilepath"; // depthkitClip.metadataFilePath;
// Debug.Log($"NamedDepthkitPlayer.ContentLabel metadataFilePath {depthkitClip.metadataFilePath}");
// string filename = depthkitClip.metadataFilePath;
// Debug.Log($"NamedDepthkitPlayer.ContentLabel metadataFile {depthkitClip.metadataFile}");
// Debug.Log($"NamedDepthkitPlayer.ContentLabel metadataFile {depthkitClip.metadataFile.name}");
if (depthkitClip.metadataFile != null) {
return depthkitClip.metadataFile.name;
}
return filename;
if (depthkitClip.poster != null) {
return depthkitClip.poster.name;
}
if (depthkitClip.player != null) {
return depthkitClip.player.GetVideoPath();
}
return "undefined-contentlabel";
// if (depthkitClip.metadataFile == null) {
// filename = depthkitClip.metadataFile.name;
// }
// if (depthkitClip.metadataSourceType == MetadataSourceType.TextAsset) {
// filename = depthkitClip.metadataFile.name;
// }
// return filename;
}
public override void UpdateComponent() {
base.UpdateComponent();
depthkitClip = GetComponent<Depthkit.Clip>();
if (depthkitClip == null) {
Debug.Log($"NamedDepthkitPlayer.UpdateComponent depthkitClip is null");
}
}
public Depthkit.Clip depthkitClip;