从 MediaElement (AS3) 中提取元数据对象
我正在尝试从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上非常简单......只需要在 URLResource 对象中使用 getMetadataValue 函数,如下所示:
This actually turned out to be pretty easy...just needed to use the getMetadataValue function in the URLResource object like this: