audiotrack position update windows phone - windows-phone-8

I am playing audio through the background audio player agent. How do I display a progress bar in the foreground indicating what position is the track currently add, like the built-in music player.

At Rob Crocombe blog you can find how to make a progressbar and use it with Background audio player. It works basing on Dispatcher Timer, which you start along with play button - the music is playing in background, timer is working in main UI and it's updating progres bar.
On the other hand, if you want want to make a slider (to be able to jump to selected position) you can use (as it's showed in blog) SuperSlider from Toolkit or you can customize your own slider as it showed here.

I done this same using Media element there i used a progressbar and Dispatcher timer on dispatcher timer tik event i updated the status of progress bar

Windows Phone Background Audio with Slider and Timer
you can find here

Related

vlcj embeddedmediaplayercomponent in Jinternal Fream Adding Issues

Jinternal frame Add jvlcEmbeddedmediaPlayerComponent problem is jDropdownlist open than list is back side list in vlc Control and other Problem is if maximize Jinternal Frame other vlc Component our Spreed Current Maximize jinternal frame look like Same thing jDropdown Control behavior.
How to Fix the Problems.
below Attach Image
You are trying to overlay a lightweight Swing component on top of a heavyweight AWT Canvas.
Use:
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
This is what the example media player provided by vlcj does:
https://github.com/caprica/vlcj/blob/vlcj-3.0.1/src/test/java/uk/co/caprica/vlcj/test/basic/TestPlayer.java

Need to create a pause/resume toggle button in Flash CS3 AS3

OK, I have seen a lot of questions and answers on how to code pause/resume buttons, but none of them fit my specific need. First let me explain what I have:
I have made a tutorial video for my job. It consists of screens shots and sounds. I have a forward button that skips to the next section (usually the start of the next audio file) and a back button that goes to the previous section. However I need a pause button.
Now let me explain how I have built it:
I have made the movie at 1fps. I have a layer for Audio, a layer for the screen shots, a layer for each button, and various other layers for highlighting things in the screen shots. On the Audio layer I placed my audio file on the stage and then dragged out the number of frames until the entire audio file could play uninterrupted. So if the audio was 10 seconds long, it lives across 10 frames. I can then put my screenshot on its own layer and do the same so that the image displays the same length of time as the audio. When the frame ends, it automatically skips to the next frame and continues on until the end. Since the audio is on the stage, the viewer doesn't need to do anything to get the audio to play.
After viewing many tutorials, it seems like most people use code to get the audio to play rather than putting it on the stage. I am not this skilled.
So my question is, with my current set up, how can I make a toggle button that basically says "If audio is playing, stop the whole show when clicked- if audio is not playing, resume show from last position when clicked"?
Thank you so much if you can help! Also, this is my first time asking a technical question like this, please let me know if you need any other specific details.
First make sure all audios on your timeline are set to "Stream". To
do this click on the frame where your audio lies, find the sound
panel, change it from Event to Stream. this will ensure that when
the timeline is stopped the audio stops and resumes when the
timeline is played.
As for the buttons simply make one that calls stop() on the timeline and one that calls play(). This will stop the timeline wherever it is and resume it on play.
var myTimeline:MovieClip;//link to the movieclip where your timeline animation lies
var btnPause:SimpleButton;//link to your pause button
btnPause.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
myTimeline.stop();
});
var btnResume:SimpleButton;//link to your resume button
btnResume.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
myTimeline.play();
});

How to ENTIRELY remove an flvplayback from stage when going to another flvplayback on another frame?

I'm trying to create an EXE projector using flash 5.5 AS3 where I have a few videos (FLVs) to show (their location is right next to the exe file in the same directory) - each load in a different frame, and all of those videos should also have a full screen option to them. Those are original videos that people WILL want to watch in full screen. It's essential for the experience...
The problem(s) I currently have (after fixing the sound that didn't stop after going to a different video) are hard to describe, but I'll try really hard.
Ok, so when I click the full screen button on a video and watch it in full screen, I will eventually want to exit the full screen, so I click on the same icon at the bottom to exit full screen (or ESC button, it's the same) and then click the navigation button to go to the SECOND FLV's frame to watch the other video. After watching the second video in full screen and then exiting full screen, flash takes me to the FIRST video's frame and that is a big problem. Also, now the button that takes me BACK to the second video's frame won't work. It's like flash is stuck.
I use the Components --> FLVPlayback 2.5 from the componant menu (I don't really know AS3 programming) and I fix its properties in the component parameters.
Also, I don't think that any of the followings are the reason for the bug, but I use these 3 scripts to stop all sound when navigating away from one frame (with an FLVplayback) to
another frame with another FLVplayback:
MyFLV.stop();
SoundMixer.stopAll();
MyFLV.addEventListener(Event.REMOVED_FROM_STAGE,xyz);
function xyz(e:Event):void{
MyFLV.stop();
}
I've found these online where people asked help for the sound bug I described.
The third script was suppose to remove the FLVplayback from the stage before going to another frame, but it works only when NOT GETTING INTO FULL SCREEN. I need something that will COMPLETELY remove the previous video from the stage so after exiting the SECOND viewed video, flash won't take me to a video that from some reason is still in its memory. I have something like 30 videos in my project and I need to remove each and every one of them off of the stage before navigating to the next frame to open a new FLVPlayback.
I tried to add a link to a demo I made with the problem so you can look at it, but it triggered a "oops, something went wrong" error, probably anti spam mechanism...
I would recommend using only one frame and only one flvplayback instance. Otherwise you have to deal with weird bugs like the one you are getting (usually caused by misplaced or forgotten code). Of course, using only one frame requires using more code, but with the number of hard-fixes it looks like you were making for the bugs, you may end up with less code.
Don't worry, I'll walk you through everything!
Reasons to use code (as opposed to multiple frames):
Easier to keep track of:
Know where all your code is so you can easily find and fix any problems.
Make changes more easily
You want to switch an existing video? edit a file reference and you are done.
Want to add a video? no more dragging a new flvplayback instance onto a new frame just add some very simple code and a button and you're done.
More customization
Reasons to use multiple frames (and multiple flvplayback instances):
easier to place visually
Some people find it easier when they have an actual movieclip that they can visually place on the stage
Less code
Here we go:
//import flv library
import fl.video.*;
This allows you to use ActionScript to manipulate the flv player
//video playback code-----------------------//
var myVideo:FLVPlayback = new FLVPlayback();
this creates an instance of FLVPlayback called myVideo (referenced from now on in the code as myVideo)
this next chunk shows many of the customizable features of the flv player. It is not necessary to include them.
//places the video player on stage at x,y
myVideo.x = 115;
myVideo.y = -10;
//uses SkinOverPlayFullscreen.swf for controls
myVideo.skin = "SkinOverPlayFullscreen.swf";
//color of controls
myVideo.skinBackgroundColor = 0x333333;
//hide controls and time it takes controls to fade and reappear (milliseconds)
myVideo.skinAutoHide=true;
myVideo.skinFadeTime=300;
//add the player to the stage
addChild(myVideo);
And now comes the important part. I have made buttons and added them to the stage. I gave each of the buttons a different instance name (box1_btn, box2_btn, and box3_btn). When someone clicks on a button, an "event" will occur.
//button listener code-------------------------//
//when button 1 is clicked throw button 1 event
box1_btn.addEventListener(MouseEvent.CLICK, clicked1);
//when button 2 is clicked throw button 2 event
box2_btn.addEventListener(MouseEvent.CLICK, clicked2);
//when button 3 is clicked throw button 3 event
box3_btn.addEventListener(MouseEvent.CLICK, clicked3);
//play different videos for different buttons---------//
//when button 1 event is thrown
function clicked1($e:MouseEvent):void
{
//play video 1.flv
myVideo.source = "1.flv";
}
//when button 2 event is thrown
function clicked2($e:MouseEvent):void
{
//play video 2.flv
myVideo.source = "2.flv";
}
//when button 3 event is thrown
function clicked3($e:MouseEvent):void
{
//play video 3.flv
myVideo.source = "3.flv";
}
This code will not have any sounds that keep playing because two videos cannot play at the same time in one instance of the player. Nor will it have any mess-ups when you come out of fullscreen because there is only one frame for the video to go back to.
Some possible problems you may run into:
It doesn't work at all:
Make sure you have added an instance of FLVPlayback to the library by adding an instance to the stage from the components menu (window>>components or ctrl+F7) and then deleting it from the stage (it should still appear in the library).
The playback buttons I want aren't showing up:
There is a great explanation of how to use As3 to manipulate FLVPlayback here:
http://www.republicofcode.com/tutorials/flash/as3flvplayback/
find the section about "Applying a Skin to the FLVPlayback Component" and follow it to use an adobe playback skin. If you want to make your own unique skin I would recommend opening and editing one of the pre-made skins. I found mine in
C:\Program Files (x86)\Adobe\Adobe Flash CS6\Common\Configuration\FLVPlayback Skins\FLA\ActionScript 3.0
I hope this helps!
Below would be simplest way to unload the FLVPlayback
removeChild(MyFLV);
it works fine for me
flvPlayBack.stop();
removeChild(flvPlayBack);
stops the sound and removes the playback.

Video Player with "double" progress bar (video loaded/video play progress)

I'm implementing an FLV video player based on Flex 3 and I would like to add a feature similar to YouTube player.
I want the progress bar to display both the video displaying progress, but also the video loaded status. How can I implement this behaviour?
Using 2 progress bars on top of each other? I'm also using Flex mx: VideoDisplay component, do I need to change this?
yes you should place two bars ontop of each other in the background you place the laodingbar and in the Front you place the current position bar.
But finally this is a bit more work than it looks to make it fully functional...
I would create a new class implementing all bar/slider functionality.
The laoder is only listening on update(val) to set its new value on percentage.
The playingbar will need some functionality on click and mousedown/mousemove for seeking AND the update function to be set again, including an event to trigger seek in the player aftern userinteraction.
Then you bind the loading bar update to the progress event of the player
All events can be found here
//setting up loadingbar
player.addEventListener(ProgressEvent.PROGRESS,slider_update);
//function to update the slider
private function slider_update(E:ProgressEvent):void{
var percentage:float = 0;
if(E.bytesTotal != 0){
E.bytesLoaded/E.bytesTotal
}
slider.update(percentage)
}
With the current playbar its allmost the same
//listens to statechanges of the player to handle updates for cur-pos
player.addEventListener(VideoEvent.PLAYHEAD_UPDATE, checkStatechange);
private function checkStatechange(E:VideoEvent):void{
if(player.totalTime!=0){
timeSlider.update(E.playheadTime/E.totalTime);
};
continue with binds on click to set seek immediatly - to mouseDown and the move to make the scrolling on video possible...
actually for the seek with mousedown the mousemove should be listening on stage so the mouseUp otherwise the user has to stay on the loadingbar while seeking this is in most cases allmost impossible to handle ;)
-have fun
}

Flash video player scrubber dragging past progress bar fill

I'm trying to troubleshoot the scrubber for a custom video player and I'm coming across an issue with the scrubber being dragged past the progress bar fill if the flv hasn't fully loaded.
The player is here:
http://mindfilemultimedia.com/stage/portfolio.html
If you play the video you will see that while the flv is still downloading, when you move the scrubber past the yellow progress bar into the white part of the line, the video player will freeze. It is doing that because the user is telling it to seek to a part of the video that has not been fully downloaded yet. What I want it to do is determine if the flv is still downloading and restrict the user to only be able to drag the scrubber up until the width of the yellow progress bar. Right now I have set the code to retrieve the bytesLoaded and bytesTotal and what I want to do is to say something like (in actionscript 3):
if (videoPlayer.bytesLoaded < videoPlayer.bytesTotal) {
var newBounds:Rectangle = new Rectangle(0, 0, (videoPlayer.bytesLoaded/videoPlayer.bytesTotal) * MovieClip(root).SeekBar.SeekProgressBar.width, 0);
MovieClip(root).SeekBar.SeekBarHandle.startDrag(false, newBounds);
}
I am by no means an actionscript person, so that was my attempt at doing what I needed. I have a feeling that it is not working because I'm accessing the classes incorrectly for the progress bar and the scrubber handle, but I am just taking the default classes as the seekbar was a flash components. Well, I can just be completely wrong. Any help here would be appreciated.
Where are you putting this code? It needs to be put somewhere, where it is updated regularly. Depending on what type of video player you were using you could see what events it dispatches and use an event listener to regularly check how much has been buffered. You could also use the enter frame event although you would need to make sure you stopped listening once the buffer is complete as it would add extra overhead on every frame.
As a side note SeekBar and SeekBarHandle should probably be seekBar and seekBarHandle respectively, as it's standard practice to start instance names with a lowercase letter in actionscript.