Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I havent done any iTunes stuff in Java for a while, but from what experience I have I remember that the interface can be rather fickle. </p> <p>I don't have any definitive answer, but in attempt to provide at least a shot in the dark, maybe you should try casting the ITPlaylist you're working with to an ITUserPlaylist (if that's the correct type, of course) and then calling <em>its</em> addTrack method. That way you'd be using the function provided by the library, and if that doesn't work you can get in touch with the developer because there may be a more serious problem occurring.</p> <p>From the dump you provided, it looks as though the underlying C in JACOB is trying to modify the equivalent ITPlaylist via the iTunes COM interface. This could be because of the way the inheritance is working? IE: ITPlaylist doesn't support addTrack (the underlying C is trying to call a nonexistent function) but ITUserPlaylist does? Just a thought.</p> <p>Suggested correction:</p> <pre><code>public void addTrack(ITTrack track) { ITPlaylistKind k = getKind(); if (k == ITPlaylistKindUser) { Dispatch.put( ((ITUserPlaylist)this).object, "AddTrack", track); } else throw new UnsupportedOperationException("can only add track to user playlists - kind : " + k); } </code></pre> <p>Again I'm certainly not the expert here so if anyone has any better ideas, please go ahead and post over me :)</p> <p>Let me know if that offers you any success!</p> <p><strong>Edit</strong> After re-reading my post, I realized I forgot this approach, which could arguably be better as it keeps the JACOB COM bridge out of the higher level stuff:</p> <pre><code>((ITUserPlaylist)this).addTrack(track); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload