when i record voice on os 5 ,i want to get AudioFormatControl to format quality , i wrote code
like this ,
player = Manager.createPlayer(encoding);
player.realize();
recordControl = (RecordControl) player.getControl(controlType);
AudioFormatControl format = (AudioFormatControl) player
.getControl("AudioFormatControl");
format.setFormat("audio/amr");
format.setParameter(FormatControl.PARAM_VERSION_TYPE,
"MPEG1_layer_3");
format.setParameter(FormatControl.PARAM_BITRATE, kbps);
player.addPlayerListener(recordListener);
but format is null ,please help me , how to get AudioFormatControl in blackberry
Related
I am using pywinusb to send/get data from Custom HID device. I can successfully send data but cant get it. Any suggestions? I tried to debug using Microsoft Message Analyzer and can see the data there but not in the script. Product/Vendor Ids, report id etc are correct.
Here the code,
from pywinusb import hid
from time import sleep
devicefilter = hid.HidDeviceFilter(vendor_id=0x0483, product_id=0x572A)
devices = devicefilter.get_devices()
print ("devices:", devices)
hid_device = devices[0]
print ("hid_device:", hid_device)
hid_device.open()
out_report = hid_device.find_output_reports()
in_report = hid_device.find_input_reports()
print("out_report:", out_report)
print("out_report[0]:",out_report[0])
print("in_report:", in_report)
print("in_report[0]:",in_report[0])
txBuffer = [0x55] * 64
txBuffer[0] = 0x01 # Report ID
rxBuffer = [0x00] * 64
rxBuffer[0] = 0x02 # Report ID
print(txBuffer)
print(rxBuffer)
out_report[0].set_raw_data(txBuffer)
in_report[0].set_raw_data(rxBuffer)
while 1:
out_report[0].send()
rxBuffer = in_report[0].get()
print("rxBuffer:", rxBuffer)
sleep(1)
hid_device.close()
I'm no expert on this my self but I have a similar sounding application Here is what I do. I don't explicitly create an input report but rather attach an input report handler to the usb receive buffer.
import pywinusb.hid as hid
# handler called when a report is received
def rx_handler(data):
print 'recv: ', data
def scan_hiddevice():
""" Scans for and returns the HID device. """
devices = hid.HidDeviceFilter( vendor_id = vendor_id).get_devices()
if not devices:
print "scan_hiddevice: No device connected."
return None
else:
device = devices[0]
#print("scan_hiddevice: found %s", device )
return device
return None
def setup_hiddevice():
"""Creates a new HID device, opens it and attaches a receive data handler"""
hid_device = scan_hiddevice()
hid_device.open()
hid_device.set_raw_data_handler(rx_handler)
return hid_device
def main(verbose=True):
hid_device = setup_hiddevice()
while (True):
#wait for data
I hope this can be of some use.
my goal is to make a funny application, that will play audio from chromium embedded component from youtube , while video will be shown from TWebBrowser component of another part of this series of movie (just for a joke)...
The problem is, i am unable to mute TWebBrowser in Delphi, however it worked in real Internet Explorer... Its enough to change the
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Play_Background_Sounds to "no" and Youtube in IE will not play audio (there is also no volume control icon on YT):
Youtube in IE
I tried to do this one in Delphi:
var rg:TRegistry ;
....
rg :=TRegistry.Create;
rg.RootKey :=HKEY_CURRENT_USER;
rg.OpenKey('\software\microsoft\internet explorer\main\',true);
rg.WriteString('Display Inline Images','no'); // for faster download - btw this one worked in TWebBrowser
rg.WriteString('Play_Background_Sounds','no'); // Not working in TWebBrowser , neither in TembeddedWB
not worked...
Also tried this one (flagged navigation):
const
DLCTL_DLIMAGES = $00000010;
DLCTL_VIDEOS = $00000020;
DLCTL_BGSOUNDS = $00000040;
DLCTL_NO_SCRIPTS = $00000080;
DLCTL_NO_JAVA = $00000100;
DLCTL_NO_RUNACTIVEXCTLS = $00000200;
DLCTL_NO_DLACTIVEXCTLS = $00000400;
DLCTL_DOWNLOADONLY = $00000800;
DLCTL_NO_FRAMEDOWNLOAD = $00001000;
DLCTL_RESYNCHRONIZE = $00002000;
DLCTL_PRAGMA_NO_CACHE = $00004000;
DLCTL_FORCEOFFLINE = $10000000;
DLCTL_NO_CLIENTPULL = $20000000;
DLCTL_SILENT = $40000000;
DLCTL_OFFLINEIFNOTCONNECTED = $80000000;
and then
var
WebPage: Integer;
flags: OleVariant;
WebPage := 'https://youtube.com/ ...';
Flags := DLCTL_BGSOUNDS +
DLCTL_PRAGMA_NO_CACHE +
0 ;
iexplorer1.navigate(webpage,flags);
no success again...
What am I doing wrong?
Every help will be appreciated..
PS: Sorry for my english
I have variable $post->post_content that return me detail of post and some video URL from YouTube.
I need to remove any text from $post->post_content else YouTube link, And add to YouTube likn this tag
<video>YouTube_URL</video>
the content like :-
At this instant, while Daggoo, on the summit of the head, was clearing the whip—which had somehow got foul of the great cutting tackles—a sharp cracking noise was heard; and to the unspeakable horror of all, one of the two enormous hooks suspending the head tore out, and with a vast vibration the enormous mass sideways swung, till the drunk ship reeled and shook as if smitten by an iceberg. The one remaining hook, upon which the entire strain now depended, seemed every instant to be on the point of giving way; an event still more likely from the violent motions of the head.
https://www.youtube.com/watch?v=JEreM0ZKY18
and some time like :-
أسر شعار اسبوعين الدولارات من, شرسة أعلنت اندلاع إذ هذا. وبعد الثالث أوكيناوا ما بين, الحصار الأمامية بـ عدد. ذات بقعة فمرّ إذ, أخذ كل بالحرب وسمّيت المانيا. و فصل بمباركة المقيتة, أملاً الحصار المتاخمة من عدد. بزمام أثره، التبرعات تم بعد, الجيش خصوصا كانتا ان دار.
https://www.youtube.com/watch?v=JEreM0ZKY18
My code:
$posts = query_posts('showposts='.$numposts.'&cat=19');
foreach ($posts as $post) {
$postOutput1 = preg_replace('#<a[^>]+>([\r\n|\n]+)?<img[^>]+>([\r\n|\n]+)?<\/a>#','', $post->post_content);
$postOutput2 = preg_replace('#https?://(www\.)?youtube.com/.[^\s.,"\']+#i','', $postOutput1);
$postOutput = preg_replace('[youtube','', $postOutput2);
preg_match_all('#https?://(www\.)?youtube.com/.[^\s.,"\']+#i', $post->post_content, $matches);
foreach($matches as $match){
echo "<video>$match</video>";
}}
How can do that.?
Try this:
$string = "At this instan ... https://www.youtube.com/watch?v=JEreM0ZKY18"
$pattern = '/(http\S*)/im';
$array = array();
preg_match($pattern, $string, $array);
$link = $array[0];
print $link;
I'm not a programmer so this is difficult for me. I want to make an extension to send the full path to the clipboard in the full format. Example:
D:\MyFolder\music\audio.mp3
I recently found and butchered this extension which sends the running time to the clipboard. Is it possible to modify it so it gets the full path instead of the running time?
I'm using VLC media player 2.0.5 Twoflower 32 bits.
Windows 7 professional 32bits SP1
Here's the content of the .lua file I'm using and want to modify:
-- Time2Clip.lua -- VLC extension --
--[[
INSTALLATION:
Put the file in the VLC subdir /lua/extensions, by default:
* Windows (all users): %ProgramFiles%\VideoLAN\VLC\lua\extensions\
Restart the VLC.
Then you simply use the extension by going to the "View" menu and selecting it.
--]]
function descriptor()
return {
title = "Time2Clip";
version = "1.0";
author = "valuex";
url = 'https://forum.videolan.org/viewtopic.php?f=29&t=101114';
shortdesc = "Time2Clip";
description = "<div style=\"background-color:lightgreen;\"><b>just a simple VLC extension </b></div>";
capabilities = {"input-listener"}
}
end
function activate()
create_dialog()
end
function close()
vlc.deactivate()
end
function create_dialog()
w = vlc.dialog("Time2Clip")
--w2 = w:add_button("Save_to_Clip", click_SAVE,2,1,1,1)
click_SAVE()
end
function click_SAVE()
local input = vlc.object.input()
if input then
local curtime=vlc.path()
-- local curtime=vlc.var.get(input, "time")
-- w2:set_text( curtime )
save_to_clipboard(curtime)
end
end
function save_to_clipboard(var)
strCmd = 'echo '..var..' |clip'
os.execute(strCmd)
vlc.deactivate()
end
I read LUA's README.TXT file and found this but I don't know how to use it. Please help me. Thanks in advance.
input.item(): Get the current input item. Input item methods are:
:uri(): Get item's URI.
:name(): Get item's name.
How about:
function descriptor()
return {
title = "URI2Clip";
version = "1.0";
author = "";
url = '';
shortdesc = "URI2Clip";
description = "<div><b>Copy the media URI to the Windows clipboard</b></div>";
}
end
function activate()
local item = vlc.input.item()
local uri = item:uri()
uri = string.gsub(uri, '^file:///', '')
uri = string.gsub(uri, '/', '\\')
strCmd = 'echo '..uri..' |clip'
os.execute(strCmd)
end
URI returns something like file:///c:/users/username/Documents/song.mp3 so I convert that to c:\users\username... format instead. NB. This is only going to work for saved files, it will mangle web addresses.
I have a server which will send my daily plans once every day to my application i've written in blackberry. Now i want to store all those in my calendar in blackberry 8520. Is it possible? Please tell what api's i should use. Thank you
Try this code.
Event _event;
Calenderevent = "Event name";
EventList eventList = (EventList) PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.WRITE_ONLY);
_event = eventList.createEvent();
long l = "Event date in long format";
_event.addString(Event.SUMMARY, PIMItem.ATTR_NONE,Calenderevent);
_event.addDate(Event.START, PIMItem.ATTR_NONE, l);
RepeatRule rule = new RepeatRule();
rule.setInt(RepeatRule.FREQUENCY,RepeatRule.YEARLY);
_event.setRepeat(rule);
//If you need to repeat the event then use repeatrule.
_event.commit();