VideoView show on GLSurfaceView? - android-videoview

recently,I'm doing android development,there have been a question that always confused me for a long time.I want to show VideoView on GLSurfaceView, my code is as following:
setContentView(glSurfaceView,new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
videoView= View.inflate(QCARSampleActivity.this, R.layout.main, null);
addContentView(videoView, new LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
mVideoView = (VideoView) overlayView.findViewById(R.id.mVideoView);
code of playing video is as following:
videoView.setVisibility(View.VISIBLE);
mVideoView.setVisibility(View.VISIBLE);
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.start();
when I run it,it works ok,but only hear sound,can't see video,why? please?

Try This:
mVideoView.setZOrderOnTop( true );

Related

Html5 notification(load particular div element to notification body)

I'm try to use html5 notification,now i'm strggle to load html element into notifications body
Below code I've tried
let string = document.getElementById('map')
let myNotification = new Notification('Incomming calls', {
body: string.innerHTML
}).addEventListener('click',function(){
console.log('Notification clicked' + message)
})
Thanks in advance
You might want to check if notification works for the browser you are using as test, better still check check this link with this also.
Then you need to be more specific about what the issue is, is there an error message or an output you don't like for us to help you better

Youtube video not playing on mobile

My embded youtube video won't play on mobile devices (desktop working fine). the videos is trigger when an image which hover it got clicked.i would like to keep it that way just to make it work on mobile.
(i know that it has something to do with the fact that i must emded it)
can you please advice
Thanks a lot!!
this is the code:
a class="thumb-video show-product-video" href="https://www.youtube.com/watch?v=fmpEyJJHBC8">
in the html, add the unique code of youtube in the last section of url
ex: http://www.youtube.com/v/fmpEyJJHBC8
try this
public string GetVideo(object MedVideo)
{
//DataRowView dRView = (DataRowView)imgSRC;
string v = MedVideo.ToString();
v = v.Substring(v.LastIndexOf("v=") + 2);
if (v.Contains("&"))
v = v.Substring(0, v.LastIndexOf("&"));
VideoURL = "http://www.youtube.com/v/" + v;
return VideoURL;
}

Different Colors in primefaces bar chart

I would like to show primefaces barchart with different colors for each bar. the most close I got is like the image:
I would like to have different color those bars, like green for "on time", yellow for "warning " and red for "overdue"
I tried to used model.setSeriesColors("58BA27,FFCC33,F74A4A,F52F2F,A30303");
but if i do that each bar should be a new series, therefore I won't be able to show the labels as I wish (like the image), I got this..
last, how can I make it show 0,1,2,3 (integers) instead repeating 0_0_0_1_1_1_2_2_2 like the image 1 :/
thanks
I solved the problem by my own reading this jplot documentation, I'm posting here hope it can help someone...
for somehow, adding extender in the tag is not working for me, I have to put it via java code:
barModel.setSeriesColors("58BA27,FFCC33,F74A4A,F52F2F,A30303");
barModel.setExtender("chartExtender");
then javascript inside
<h:outputScript>
function chartExtender() {
// this = chart widget instance
// this.cfg = options
this.cfg.seriesDefaults.rendererOptions.varyBarColor = true;
}
</h:outputScript>
and done!
I'm new here, so I unfortunately cannot add a comment to your answer.
It worked for me too.
Some clarifications for other readers:
Be sure to put the <h:outputScript> under your <p:chart... like:
<p:chart type="bar" model="#{bean.someModel}">
<h:outputScript>
function chartExtender() {
// this = chart widget instance
// this.cfg = options
this.cfg.seriesDefaults.rendererOptions.varyBarColor = true;
}
</h:outputScript>
</p:chart>
The "extender" -Tag has been removed in Primefaces 5:
see this answer

backbone.js Image uploading

I'm using nodecellar to get a better understanding of backbone.js and I've come across a problem which was answered in great detail in a similar question, however, the answer doesn't seem to be working for me:
What i'm trying to do.
Using Nodecellars wineview, i'm trying to utilise the drag and drop feature, to upload an image. I've made a note of a previous very well answered question which basically states that you have to disable the default behaviour of on dragover, so I have the following in my wine view:
events: {
"change" : "change",
"click .save" : "beforeSave",
"click .delete" : "deleteWine",
"drop #profile" : "dropHandler",
"dragover #profile" : "dragover",
'dragenter #profile' : 'alertMe'
},
then my dragover event looks like this:
dragover: function(event){
console.log('drag over event called');
event.preventDefault();
},
This is fine and working as the console log is called when it fires. and the draghandler looks like this:
dropHandler: function (event) {
event.stopPropagation();
event.preventDefault();
var e = event.originalEvent;
e.dataTransfer.dropEffect = 'copy';
this.pictureFile = e.dataTransfer.files[0];
// Read the image file from the local file system and display it in the img tag
var reader = new FileReader();
reader.onloadend = function () {
$('#profile').attr('src', reader.result);
$('#picText').html('Picture added, select save to complete changes.')
};
reader.readAsDataURL(this.pictureFile);
}
The problem
The code works, however it doesn't upload the image or save the details in the model to the database. so once I move away then select the wine again the image is back to what it was originally.
I've done some research into the HTML5 fileReader api, but there isn't much on how it uploads, or where it uploads to.
And this is where I am now, I'm looking to you guys for suggestions on how to ensure the model saves the image url, and the image is uploaded to the pics folder.
How is the best way to go about this.
Is the HTML 5 fileReader API the best option to go with?
Thank you for your feedback.
Jay
You are missing in your function dropHandler the call to your model to set the property for the image you want to save.

Flash QuickBox2d skinMc.gotoAndPlay(1);

I have this quickBox2d code to add a cricle to the stage:
var ball:QuickObject = sim.addCircle( {skin:skinMc, x:10, y:10, radius:3, density:0 } );
The skinMc contains animations so I want to be able to refer to it like this: skinMc.gotoAndPlay(5); but it says
Type Coercion failed: cannot convert skinMc$ to flash.display.MovieClip.
ball.gotoAndPlay(5); doesn't work either since it's a QuickObject, not an mc...
Any help will be appreciated
Thanks
ball.userData.gotoAndPlay(5);
userData will be a DisplayObject populated by QuickBox2D.
var sim:QuickBox2D = new QuickBox2D
var ball:QuickObject = sim.addCircle( {skin:skinMc, x:10, y:10, radius:3, density:0 } );
//something along these lines
So to reference the object you can use:
sim.gotoAndPlay("5");
im not 100% on what your doin but i installed both packages and created a quick document and it works fine on my machine.
if need be try this link http://www.emanueleferonato.com/2009/08/25/simplify-your-box2d-projects-with-quickbox2d/
if this fails,send me your file or else let me know how you go.