| Author |
Message |
Frank Peters
Guest
|
Posted:
Tue Sep 21, 2004 1:03 am Post subject:
displaying embedded cover art in wma file |
|
|
I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0)
|
|
| Back to top |
|
 |
Neil Smith [MVP Digital M
Guest
|
Posted:
Tue Sep 21, 2004 1:45 am Post subject:
Re: displaying embedded cover art in wma file |
|
|
Yes, you have to use your languages equivalent of try....catch blocks
with this command as it is documented to throw errors if the specified
attribute is not available.
The SDK docs state : "This method can throw errors. You should include
error handling code when you call this method".
You can however use getItemInfo instead unless you need multiple
attribute support. getItemInfo doesn't throw errors but can be slower
to execute.
HTH
CHeers - Neil
On Mon, 20 Sep 2004 21:03:43 GMT, Frank Peters <frankpeters@msn.com>
wrote:
| Quote: | I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0) |
|
|
| Back to top |
|
 |
Frank Peters
Guest
|
Posted:
Tue Sep 21, 2004 6:08 pm Post subject:
Re: displaying embedded cover art in wma file |
|
|
Thank you for the Reply Neil,
I am currently using GetItemInfo for all the attributes that are stored
as strings. I need to use GetItemInfoByType to retrieve complex types
(embedded artwork)
I gave it a try and as expected, here is the exception that was thrown.
System.ArgumentException: The parameter is incorrect.
at WMPLib.IWMPMedia3.getItemInfoByType(String bstrType, String
bstrLanguage, Int32 lIndex)
I should note that the image is embedded in an mp3 file using the ID3
"APIC" tag. Acording to the docs in the WM SDK, this should work. I
have also tried adding the WM/Picture tag using WMP version 10.
Neil Smith [MVP Digital Media] wrote:
| Quote: | Yes, you have to use your languages equivalent of try....catch blocks
with this command as it is documented to throw errors if the specified
attribute is not available.
The SDK docs state : "This method can throw errors. You should include
error handling code when you call this method".
You can however use getItemInfo instead unless you need multiple
attribute support. getItemInfo doesn't throw errors but can be slower
to execute.
HTH
CHeers - Neil
On Mon, 20 Sep 2004 21:03:43 GMT, Frank Peters <frankpeters@msn.com
wrote:
I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0)
|
|
|
| Back to top |
|
 |
Neil Smith [MVP Digital M
Guest
|
Posted:
Wed Sep 22, 2004 3:56 am Post subject:
Re: displaying embedded cover art in wma file |
|
|
On Tue, 21 Sep 2004 14:08:33 GMT, Frank Peters <frankpeters@msn.com>
wrote:
| Quote: | Thank you for the Reply Neil,
I am currently using GetItemInfo for all the attributes that are stored
as strings. I need to use GetItemInfoByType to retrieve complex types
(embedded artwork)
I gave it a try and as expected, here is the exception that was thrown.
System.ArgumentException: The parameter is incorrect.
at WMPLib.IWMPMedia3.getItemInfoByType(String bstrType, String
bstrLanguage, Int32 lIndex)
|
Yes, but now after the TRY block you should use a CATCH block, and
catch the exception. And use null or an empty string as the output of
the catch block.
This exception is actually saying there's no value for the specified
attribute (it's empty) so you should return whatever empty value is
suitable for your application.
HTH
Chers - Neil
| Quote: | I should note that the image is embedded in an mp3 file using the ID3
"APIC" tag. Acording to the docs in the WM SDK, this should work. I
have also tried adding the WM/Picture tag using WMP version 10.
|
Can you show me the URL of the SDK documents which refer to using ID3
APIC tags ? I'm not aware of this but it could be new. Cheers - Neil
| Quote: |
Neil Smith [MVP Digital Media] wrote:
Yes, you have to use your languages equivalent of try....catch blocks
with this command as it is documented to throw errors if the specified
attribute is not available.
The SDK docs state : "This method can throw errors. You should include
error handling code when you call this method".
You can however use getItemInfo instead unless you need multiple
attribute support. getItemInfo doesn't throw errors but can be slower
to execute.
HTH
CHeers - Neil
On Mon, 20 Sep 2004 21:03:43 GMT, Frank Peters <frankpeters@msn.com
wrote:
I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0)
|
|
|
| Back to top |
|
 |
Frank Peters
Guest
|
Posted:
Thu Sep 23, 2004 6:09 pm Post subject:
Re: displaying embedded cover art in wma file |
|
|
I am catching the exception, I was just unclear on the error "The
parameter is incorrect". Thanks for the clarification.
Neil Smith [MVP Digital Media] wrote:
| Quote: | On Tue, 21 Sep 2004 14:08:33 GMT, Frank Peters <frankpeters@msn.com
wrote:
Thank you for the Reply Neil,
I am currently using GetItemInfo for all the attributes that are stored
as strings. I need to use GetItemInfoByType to retrieve complex types
(embedded artwork)
I gave it a try and as expected, here is the exception that was thrown.
System.ArgumentException: The parameter is incorrect.
at WMPLib.IWMPMedia3.getItemInfoByType(String bstrType, String
bstrLanguage, Int32 lIndex)
Yes, but now after the TRY block you should use a CATCH block, and
catch the exception. And use null or an empty string as the output of
the catch block.
This exception is actually saying there's no value for the specified
attribute (it's empty) so you should return whatever empty value is
suitable for your application.
HTH
Chers - Neil
I should note that the image is embedded in an mp3 file using the ID3
"APIC" tag. Acording to the docs in the WM SDK, this should work. I
have also tried adding the WM/Picture tag using WMP version 10.
Can you show me the URL of the SDK documents which refer to using ID3
APIC tags ? I'm not aware of this but it could be new. Cheers - Neil
Neil Smith [MVP Digital Media] wrote:
Yes, you have to use your languages equivalent of try....catch blocks
with this command as it is documented to throw errors if the specified
attribute is not available.
The SDK docs state : "This method can throw errors. You should include
error handling code when you call this method".
You can however use getItemInfo instead unless you need multiple
attribute support. getItemInfo doesn't throw errors but can be slower
to execute.
HTH
CHeers - Neil
On Mon, 20 Sep 2004 21:03:43 GMT, Frank Peters <frankpeters@msn.com
wrote:
I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0)
|
|
|
| Back to top |
|
 |
Neil Smith [MVP Digital M
Guest
|
Posted:
Fri Sep 24, 2004 2:55 am Post subject:
Re: displaying embedded cover art in wma file |
|
|
Cool, NP.
On Thu, 23 Sep 2004 14:09:02 GMT, Frank Peters <frankpeters@msn.com>
wrote:
| Quote: | I am catching the exception, I was just unclear on the error "The
parameter is incorrect". Thanks for the clarification.
Neil Smith [MVP Digital Media] wrote:
On Tue, 21 Sep 2004 14:08:33 GMT, Frank Peters <frankpeters@msn.com
wrote:
Thank you for the Reply Neil,
I am currently using GetItemInfo for all the attributes that are stored
as strings. I need to use GetItemInfoByType to retrieve complex types
(embedded artwork)
I gave it a try and as expected, here is the exception that was thrown.
System.ArgumentException: The parameter is incorrect.
at WMPLib.IWMPMedia3.getItemInfoByType(String bstrType, String
bstrLanguage, Int32 lIndex)
Yes, but now after the TRY block you should use a CATCH block, and
catch the exception. And use null or an empty string as the output of
the catch block.
This exception is actually saying there's no value for the specified
attribute (it's empty) so you should return whatever empty value is
suitable for your application.
HTH
Chers - Neil
I should note that the image is embedded in an mp3 file using the ID3
"APIC" tag. Acording to the docs in the WM SDK, this should work. I
have also tried adding the WM/Picture tag using WMP version 10.
Can you show me the URL of the SDK documents which refer to using ID3
APIC tags ? I'm not aware of this but it could be new. Cheers - Neil
Neil Smith [MVP Digital Media] wrote:
Yes, you have to use your languages equivalent of try....catch blocks
with this command as it is documented to throw errors if the specified
attribute is not available.
The SDK docs state : "This method can throw errors. You should include
error handling code when you call this method".
You can however use getItemInfo instead unless you need multiple
attribute support. getItemInfo doesn't throw errors but can be slower
to execute.
HTH
CHeers - Neil
On Mon, 20 Sep 2004 21:03:43 GMT, Frank Peters <frankpeters@msn.com
wrote:
I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0)
|
|
|
| Back to top |
|
 |
prathip
Guest
|
Posted:
Thu Sep 30, 2004 7:39 pm Post subject:
Re: displaying embedded cover art in wma file |
|
|
To my knowledge, you cannot extract the picture using the media player sdk.
The WM/Picture is an attribute of the Media Format SDK. Thus, its illegal to
use the WM/Player attribute name in the mediaplayer sdk program.
"Frank Peters" wrote:
| Quote: | I am catching the exception, I was just unclear on the error "The
parameter is incorrect". Thanks for the clarification.
Neil Smith [MVP Digital Media] wrote:
On Tue, 21 Sep 2004 14:08:33 GMT, Frank Peters <frankpeters@msn.com
wrote:
Thank you for the Reply Neil,
I am currently using GetItemInfo for all the attributes that are stored
as strings. I need to use GetItemInfoByType to retrieve complex types
(embedded artwork)
I gave it a try and as expected, here is the exception that was thrown.
System.ArgumentException: The parameter is incorrect.
at WMPLib.IWMPMedia3.getItemInfoByType(String bstrType, String
bstrLanguage, Int32 lIndex)
Yes, but now after the TRY block you should use a CATCH block, and
catch the exception. And use null or an empty string as the output of
the catch block.
This exception is actually saying there's no value for the specified
attribute (it's empty) so you should return whatever empty value is
suitable for your application.
HTH
Chers - Neil
I should note that the image is embedded in an mp3 file using the ID3
"APIC" tag. Acording to the docs in the WM SDK, this should work. I
have also tried adding the WM/Picture tag using WMP version 10.
Can you show me the URL of the SDK documents which refer to using ID3
APIC tags ? I'm not aware of this but it could be new. Cheers - Neil
Neil Smith [MVP Digital Media] wrote:
Yes, you have to use your languages equivalent of try....catch blocks
with this command as it is documented to throw errors if the specified
attribute is not available.
The SDK docs state : "This method can throw errors. You should include
error handling code when you call this method".
You can however use getItemInfo instead unless you need multiple
attribute support. getItemInfo doesn't throw errors but can be slower
to execute.
HTH
CHeers - Neil
On Mon, 20 Sep 2004 21:03:43 GMT, Frank Peters <frankpeters@msn.com
wrote:
I am getting a runtime error trying to retrieve the WM/Picture metadata
from my test wma file.
ERROR when executing: pic = media.getItemInfoByType("WM/Picture", "", 0)
An unhandled exception of type 'System.ArgumentException' occurred in
WindowsApplication2.exe
Additional information: The parameter is incorrect.
Here is a snippet from my code
Any help would be greatly appreciated
Imports WMPLib.WindowsMediaPlayerClass
Public Class Form1
Inherits System.Windows.Forms.Form
Dim AlbumName As String
Dim ArtistName As String
Dim SongName As String
Dim Path As String
Dim WithEvents mplayer As WMPLib.WindowsMediaPlayer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
mplayer = New WMPLib.WindowsMediaPlayer
mplayer.URL = Path.Text
mplayer.controls.play()
Dim media As WMPLib.IWMPMedia3
media = mplayer.newMedia(Path.Text)
** These calls succeed **
AlbumName.Text = media.getItemInfo("WM/AlbumTitle")
ArtistName.Text = media.getItemInfo("Author")
SongName.Text = media.getItemInfoByType("Title", "", 0)
Dim pic As WMPLib.IWMPMetadataPicture
** The following call causes the error:
System.ArgumentException
The parameter is incorrect.
**
pic = media.getItemInfoByType("WM/Picture", "", 0)
|
|
|
| Back to top |
|
 |
|
|
|
|