Click here to Skip to main content
11,493,391 members (60,435 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Blackberry
I used a code to play a song in blackberry.
public VideoPlaybackDemoScreen() {
		
		Class cl = null;
		
		try {
			cl = Class.forName("mypackage.VideoPlaybackDemoScreen");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		if (cl != null) {
			try {
				InputStream is = getClass().getResourceAsStream(
						"/mzm.yzzwpvvt..640x348.h264lc.u.p.m4v");
				final Player player = javax.microedition.media.Manager
						.createPlayer(is, "video/m4v");
				player.realize();
 
				VideoControl videoControl = (VideoControl) player
						.getControl("VideoControl");
				Field videoField = (Field) videoControl.initDisplayMode(
						VideoControl.USE_GUI_PRIMITIVE,
						"net.rim.device.api.ui.Field");
				videoControl.setDisplaySize(480, 256);
				videoControl.setVisible(true);
 
				add(new LabelField("Top", 0));
				add(videoField);
				add(new LabelField("Bottom", 0));
				final int i = 30;
 
				final VolumeControl volume = (VolumeControl) player
						.getControl("VolumeControl");
				ButtonField volumeIncrease = new ButtonField("Volume Increase") {
					protected boolean navigationClick(int status, int time) {
						VolumeControl volC = (VolumeControl) player
								.getControl("VolumeControl");
						int volume = volC.getLevel() + 10;
						volC.setLevel(volume);
						Dialog.alert(String.valueOf(volume));
						return true;
					}
				};
				ButtonField volumeDecrease = new ButtonField("Volume Decrese") {
					protected boolean navigationClick(int status, int time) {
						VolumeControl volC = (VolumeControl) player
								.getControl("VolumeControl");
						int volume = volC.getLevel() - 10;
						volC.setLevel(volume);
						return true;
					}
				};
				add(volumeIncrease);
				add(volumeDecrease);
				player.start();
 
			} catch (IOException e) {
				Dialog.alert(e.getMessage());
			} catch (MediaException e) {
				Dialog.alert(e.getMessage());
			}
 
		}
	}

I used above code to play .m4a and .m4a songs. But when try to play .m4v songs, it gives an error message like "format is not supporting". If anybody knows how to play .m4v and .m4a songs in blackberry plaese let me know. thanks.
Posted 28-Oct-12 8:06am
Comments
TorstenH. at 29-Oct-12 6:43am
   
Have you checked out the developer community @ Blackberry website?
You are getting into Blackberry-specific stuff more and more. You should go there, there might be more suitable solutions available.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 393
1 Maciej Los 286
2 F-ES Sitecore 224
3 KarstenK 210
4 CPallini 208
0 Sergey Alexandrovich Kryukov 10,132
1 OriginalGriff 8,630
2 Sascha Lefèvre 3,624
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 28 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100