Doubts in blackberrycontentHandler - blackberry

i am trying to playing music file,using content handler,and this is code syntax i used
//Create invocation
Invocation invocation =
new Invocation(filePath,null,BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER);
// Get the registry object
Registry registry = Registry.getRegistry("net.rim.device.api.content.BlackBerryContentHandler");//here i changed to my own file
//Invoke the content handler.
registry.invoke(invocation);
When the application runs.it navigates to media application screen,but it just stays out there,and can't play music or media file ,Any ideas what could be problem?
Regards
Rakesh Shankar.P

I have tried this code and its working fine for me
Invocation invocation = new Invocation("file:///SDCard/B.mp3",
null, BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER);
Registry.getRegistry(getClass().getName()).invoke(invocation);

Related

How to record live streaming video?

I'm using VideoCore library for streaming the live video which is working perfectly.
my requirement is that i want that live streaming video record and store in document directory so anyone can tell me how can i do that?
how can i record live streaming video?
I checked library and it looks like the only way to have record function is creation of custom output.
There is Split class which allows to push a buffer to multiple outputs. So you need to create new IOuput implementation with file saving function and add it to flow using that Split class.
Update #1
I found that there is a file output example inside library (VCSimpleSession.mm file):
{
m_h264Packetizer = std::make_shared<videocore::rtmp::H264Packetizer>(ctsOffset);
m_aacPacketizer = std::make_shared<videocore::rtmp::AACPacketizer>(self.audioSampleRate, self.audioChannelCount, ctsOffset);
m_h264Split->setOutput(m_h264Packetizer);
m_aacSplit->setOutput(m_aacPacketizer);
}
{
/*m_muxer = std::make_shared<videocore::Apple::MP4Multiplexer>();
videocore::Apple::MP4SessionParameters_t parms(0.) ;
std::string file = [[[self applicationDocumentsDirectory] stringByAppendingString:#"/output.mp4"] UTF8String];
parms.setData(file, self.fps, self.videoSize.width, self.videoSize.height);
m_muxer->setSessionParameters(parms);
m_aacSplit->setOutput(m_muxer);
m_h264Split->setOutput(m_muxer);*/
}
m_h264Packetizer->setOutput(m_outputSession);
m_aacPacketizer->setOutput(m_outputSession);
Try to uncomment it and check.

ROKU-Using urlTransfer to Call Script File

Not sure how Roku and Brightscript actually works. I need to call a script file just before the channel starts to stream. The script file will convert the stream on fly. I asked how to do this in Roku forum and was told to use urlTransfer. Well, the sdk gives little help that I can see when explaining how to. I ran across this post on stackoverflow:
How to make api request to some server in roku
It gives a good example which I think I understand. My confusion comes in where and how the function is called. It has to happen right before the video url is called so the conversion can start.
Any advice appreciated.
If you are using roVideoPlayer then just before you call the play function and if you are using roVideoScreen then just before the show function.
Example snippet:
roVideoPlayer
player=CreateObject('roVideoPlayer')
* Your code to add content for the player
* Your call to script
player.play()
roVideoScreen
player=CreateObject('roVideoScreen')
* Your code to add content for the player
* Your call to script
player.show()
Hope this helps

No sound on BlackBerry with openfl

I try to use haxe (openfl) for blackberry development.
And I test PlayingSound sample - it works.
But when I try to load sound from url - doesn't work.
Here is my code:
public function PlaySong(url:String):Void{
var _url:URLRequest = new URLRequest(url);
if (_soundChannel != null) _soundChannel.stop();
_song = new Sound();
_song.load(_url); //<--Do not work
//_song = Assets.getSound("assets/stars.mp3"); <--work
_soundChannel =_song.play(0);
}
In the flash target this code is playing my sound from the url, but when I deploy app to my device - it have no sound. On the device, sound is playing correctly only if I load it from the asset folder.
Also, I see that soundChannel position is always 0 (on device);
I try firstly to load the sound with loader, and then play it, when the loading is complete, but it's not help me too.
Help me, please.
PS Sorry for my English.
Have you tried loading it using this:
var loader:URLLoader = URLLoader(new URLRequest("url"));
loader.data = DataFormat.BINARY;
then try
loader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event):Void
{
sound.loadCompressedDataFromByteArray(e.data.content)
}
Try to load bytes first, then create sound from that.
Anyway, if your code works on other mobile devices(maybe emulators), then create new issue here:
https://github.com/openfl/openfl

xna the given key was not present in the dictionary

Hello Im working with xna and had a little problem with XACT and playing some background music.Basically I have followed this guide http://rbwhitaker.wikidot.com/playing-sound to play sound . I have declared all the variables:
private AudioEngine audioEngine;
private WaveBank waveBank;
private SoundBank soundBank;
and in the LoadContent i have load them their sound information
audioEngine = new AudioEngine("Content\\XactMusic\\inGameMusic.xgs");
waveBank = new WaveBank(audioEngine, "Content\\XactMusic\\Wave Bank.xwb")
soundBank = new SoundBank(audioEngine, "Content\\XactMusic\\Sound Bank.xsb");
while at the XACT tool I have created a waveBank and a soundBank and have loaded a .wav file.
The problem is that when I try to compile an error pops up :
Building content threw KeyNotFoundException: The given key was not present in the dictionary.
What am I doing wrong??

Flex/Flash Builder/Actionscript/AIR/Mobile iOS How to take video using the camera and/or browse for & view/access video stored in the 'Camera Roll"

My understanding currently is that:
CameraUI
I can use the CameraUI to access the built in camera for MediaType.VIDEO and that delegates to the built-in video camera app and lets me record a video. My app does that now.
When I stop recording and click the "Use" button, I am returned to my app and theoretically I have a valid MediaPromise.
iOS does -not- provide a valid/usable url/filename to the recorded video (or to photos) and so I would have to use a Loader to bring-in/use/access the 'recorded' video... AND... iOS does not actually create a file anywhere on the device, most importantly, in the Camera Roll where one would expect by the normal behavior when uses the system native camera/video app.
The documentation says that the Loader can load various image types and SWFs but nothing about video data, so I conclude from that that I cannot actually use the CameraUI to generate a valid MediaPromise that I can then pass to a Loader class or similar to read in the information created by the system camera and then manipulate (upload, save to applicationStorageDirectory, and/or display in one of the two video player components available in the API).
CameraRoll
I can have video entities in the iOS Camera Roll but the AS3/Air3.5 CameraRoll class won't let me view/access/reference them in any way.
Normal File I/O
All my attempts to use the Air3.5 File classes to browse to the storage location of the iOS Camera Roll have been rebuffed.
------- Questions -------
Am I correct in believing that there is a way to take video but no way to use the video that's been captured. (No way to use the resulting MediaPromise successfully).
I believe you can take video and access it using Android, but there's nothing in the documentation that says that you cannot using iOS.
Am I correct in believing that iOS sandboxes apps so that they cannot browse to video/photo storage using standard File I/O, but only through the apparently non-workable means I've tried (CameraUI & CameraRoll)
Am I wrong to think that these should be rather obvious NEEDS that one can achieve using the XCode Objective C++ etc route but the AIR Mobile Framework does not allow either because of Apple blocking functionality or because Adobe has failed to meet reasonable expectations?
One item of ironic note to convey. If I use the iOS system camera app to record a video, a thumnail of that video then appears in the Gallery/Camera Roll, and of course, I can share it or view it, or whatever... If I use AIR's CameraRoll.browseForImage(), provided I haven't used the camera to take another image, when it shows me the folder where the pictures are stored, the folder icon uses the thumbnail of the last object added... in this case, the video I took, but if I then enter the folder, the video cannot be found. It's teasing us. It knows it's there, but it is apparently forbidden fruit.
I can't answer all your questions, so this entry may not be acceptable, but I found this page while searching a solution for some the problems you described and thought that someone else may find this answer (partially) useful.
To save the movie you just took you need to open and read the data from the promise.
The iOS won't save the file anywere, so the MediaPromise.file is always null.
This is my solution to the problem:
private var camera:CameraUI;
private var dataInput:IDataInput;
public function recordVideo():void
{
// Start the camera and ask for a video
camera = new CameraUI();
camera.addEventListener(MediaEvent.COMPLETE, onCameraComplete);
camera.launch(MediaType.VIDEO);
}
private function onCameraComplete(event:MediaEvent):void
{
// event.data is a MediaPromise and MediaPromise.open() returns a IDataInput
// Let's cast it to a dispatcher and check when it's complete
dataInput = event.data.open();
var dispatcher:IEventDispatcher = IEventDispatcher(dataInput);
dispatcher.addEventListener(Event.COMPLETE, onDataInputComplete);
}
private function onDataInputComplete(event:Event):void
{
// We can do whatever we want with the data, so we'll store it in a File
var file:File = new File();
var bytes:ByteArray = new ByteArray();
var stream:FileStream = new FileStream();
// Reading the data from the opened MediaPromise
dataInput.readBytes(bytes);
stream.open(file, FileMode.WRITE);
stream.writeBytes(bytes, 0, bytes.bytesAvailable);
stream.close();
}
Also, I'm still looking for a way to put the movie in the CameraRoll

Resources