Media.imageSourceWidth
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
imageSourceWidth 属性检索当前媒体项的宽度(以像素为单位)。
语法
玩家。currentMedia。imageSourceWidth
可能的值
此属性是只读 Number (长) 。
备注
如果媒体项不是当前媒体项,则此属性返回零。
若要检索此属性的值,需要对库的读取访问权限。 有关详细信息,请参阅 库访问。
示例
以下 JScript 示例使用 媒体。imageSourceWidth 用于显示当前媒体项的图像大小(以像素为单位 )。该信息将打印到名为 VideoSize 的 HTML TEXTAREA 元素。创建的 Player 对象 ID 为“player”。
<!-- Create an event handler to refresh the information when the current media changes. -->
<SCRIPT LANGUAGE = "JScript" FOR = "Player" EVENT = OpenStateChange(NewState)>
// Test whether the new media item is open.
if (NewState == 13){
// Store the height and width of the new media item.
var Height = Player.currentMedia.imageSourceHeight;
var Width = Player.currentMedia.imageSourceWidth;
// Erase the information in the text area.
VideoSize.value = "";
// Test whether an image is visible.
if (Height != 0 && Width != 0)
// Display the image size information.
VideoSize.value = Width + " x " + Height;
}
</SCRIPT>
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器版本 7.0 或更高版本。 |
DLL |
|
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈