从 MediaElement (AS3) 中提取元数据对象

发布于 2024-10-08 18:34:39 字数 1390 浏览 4 评论 0原文

我正在尝试从 URLResource 检索元数据。 URLResource 不受我控制,而是传递到我正在使用的函数中。

URLResource 的创建方式如下:

var resource:URLResource = new URLResource("http://mediapm.edgesuite.net/osmf/content/test/logo_animated.flv");

// Add Metadata for the URLResource
var VideoParams:Object = {
Name:"Logo Video",
Owner:"Self",
Duration:"1:25:20",
category:"education"
}

resource.addMetadataValue("VideoParams", VideoParams);
var media:MediaElement = factory.createMediaElement(resource);

现在 URLResource 包含元数据。我将收到 MediaElement 资源。如何提取回元数据?

这是调试器显示的内容(媒体是包含 URLResource w/元数据的 MediaElement 对象):

fdb>print media.resource.
$1 = [Object 246396705, class='org.osmf.media::URLResource']
_mediaType = null
_metadata = [Object 416970209, class='flash.utils::Dictionary']
_mimeType = null
url = "http://mediapm.edgesuite.net/osmf/content/test/logo_animated.flv"
fdb>print media.resource._metadata.
$2 = metadata = [Object 416970209, class='flash.utils::Dictionary']
VideoParams = [Object 416970305, class='Object']
(fdb)print media.resource._metadata.VideoParams.
$3 = VideoParams = [Object 416970305, class='Object']
category = "education"
Duration = "1:25:20"
Owner = "Self"
Name = "Logo Video"

我尝试使用以下命令提取元数据对象:

media.resource.getMetadata("VideoParams");

以及许多其他尝试,但无法弄清楚如何获取该死的元数据。

任何想法都非常感激!

I am attempting to retrieve metadata from a URLResource. The URLResource is not controlled by me, but passed into a function that I am using.

The URLResource is created like this:

var resource:URLResource = new URLResource("http://mediapm.edgesuite.net/osmf/content/test/logo_animated.flv");

// Add Metadata for the URLResource
var VideoParams:Object = {
Name:"Logo Video",
Owner:"Self",
Duration:"1:25:20",
category:"education"
}

resource.addMetadataValue("VideoParams", VideoParams);
var media:MediaElement = factory.createMediaElement(resource);

Now the URLResource contains the metadata. I will recieve a MediaElement resource. How do I extract the metadata back?

Here's what the debugger shows (media is a MediaElement object containing the URLResource w/ metadata) :

fdb>print media.resource.
$1 = [Object 246396705, class='org.osmf.media::URLResource']
_mediaType = null
_metadata = [Object 416970209, class='flash.utils::Dictionary']
_mimeType = null
url = "http://mediapm.edgesuite.net/osmf/content/test/logo_animated.flv"
fdb>print media.resource._metadata.
$2 = metadata = [Object 416970209, class='flash.utils::Dictionary']
VideoParams = [Object 416970305, class='Object']
(fdb)print media.resource._metadata.VideoParams.
$3 = VideoParams = [Object 416970305, class='Object']
category = "education"
Duration = "1:25:20"
Owner = "Self"
Name = "Logo Video"

I've attempted extracting the metadata object with:

media.resource.getMetadata("VideoParams");

and a host of other attempts, but can't figure out how to get at that darned metadata.

Any thoughts greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生生不灭 2024-10-15 18:34:40

这实际上非常简单......只需要在 URLResource 对象中使用 getMetadataValue 函数,如下所示:

var temp:Object = media.resource.getMetadataValue("VideoParams");
trace('Owner:', temp.Owner);

This actually turned out to be pretty easy...just needed to use the getMetadataValue function in the URLResource object like this:

var temp:Object = media.resource.getMetadataValue("VideoParams");
trace('Owner:', temp.Owner);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文