Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I used a code to play a song in blackberry.
Java
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
Comments
TorstenH. 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900