Set an Empty SRC on MediaElement.js Player? - html5-audio

I have a single audio player on a page. Users can select an audio track to load. In between selections, I would like to set the source of the audio player to nothing. Passing an empty string to "setSrc" produces the undesired effect of a "Download File" message.
So what is the best way to achieve this? Currently I am passing a string to "setSrc" that I know is not a file, and this kind of produces the desired effect, but is obviously not ideal.
https://github.com/johndyer/mediaelement/issues/587

I had a related issue. I built an audio player which loads tracks dynamically. Problem was I had to set something as a src when creating the audio tag. I even tried using base64 encoded empty mp3, only to learn that it will make the Flash fallback throw exceptions.
It's not very well documented, but eventually I realised that if I initialise the MediaElement with parameter 'type' set to 'audio/mp3' (in my case), there is no need to set src initially.
From what I can see in mediaelement.js, it only requires the src for determining media type e.g. (.mp3, .mpg etc).
So to answer your question, once you've set type explicitly, you should be able to set src to "nothing".

Related

File Input accept every type of file, but not video and image

I want to implement an HTML5 file picker <input type="file" ...> which accepts all kinds of files.
But it should let the user select image/* and video/* files.
To be more precise: I'm trying to disallow images and videos. Anything else should be allowed.
The only way I currently see is to define a set of accepted file extensions (and/or mime types), but I don't think it's feasible to add a list of hundreds of mime types just to prevent that the user can select image and video files. So that wouldn't be a satisfying solution.
I'd prefer a JavaScript free solution, if possible.
Hope this Below link will help you in resolving your problem basically you need to add accept attribute to your input element and add the file types as the value which you want the user to upload.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

Field for include HTML5 video player on drupal with popular plateform content

I'm building a website with drupal and I would like to add a field for adding an html5 video player with content from YouTube and another popular plateform.
I thought that I'd find my happiness with the module "Embedded Media Field". I had to install it and by the same occasion the full "Media" modul.
So I've got a field when I create a new article but when I submit the form I've got the following error message : "Found no valid media with that url."
However when I look at this video : "https://www.youtube.com/watch?v=YsAnxoGsCOI", the user can add video easily.
But If you look the video at the minute 3, when the user create the field, He can choose between different fields types like "Embedded Video", "Embedded Audio" and over.
I don't have this possibility !
Seem the module "Embedded Media Field" should be included in "Embedded Media Field," but I have a big doubt because it don't appear in my list of modules ... and I don't find it in the module directory on https://www.drupal.org/project/
So who can say me what module to use for :
- adding an html5 responsive player;
- adding a video gallery;
Big thankz by advance !
Mickael
I would take a look at the video module. This module will take care of the video field, conversion, thumbnails, etc. Then you will need to add a HTML5 video player module to display the video. I've used VideoJS and it's worked pretty well.
An easy method to put video up - as long as you have the files - is to use my newly released HTML5 SimplePlayer https://www.drupal.org/project/simpleplayer
It works with audio and video - but it has NO Flash fallback, so really old browsers won't work. The thing is: there are very few of those now. Basically ALL mobile devices work, and any computer you've gotten in the last decade can run this.
It's low-weight for mobile, and it has no other required dependencies.

ASP Flash Variables Issue

I have .asp data coming into flash through a URLRequest like this:
http://www.thewebsite.com/aspTest.asp?courseNum=123 where courseNum will vary.
This causes an issue with my flash piece because the courseNum var is changing, but still need it to dynamically load the right courseNum. How could I set this up within flash to recgonize what courseNum I need?
Inital though would be to create an input field in flash and have the user enter in the courseNum and submit it which would append the URL and load the data, but Im trying to limit user input to a minium. Any ideas? Thank you for your help.
...In that case you can pass it using Flashvars. I also strongly suggest you using SWFObject to embed your swf file - it's a very easy thing to do.

Soundcloud: single_active parameter in HTML5 widget?

is there any chance the HTML5 will be updated soon with the single_active parameter to allow simultaneous audio tracks playing in a page?
Thanks
It actually already is an option of the HTML5 widget. You disable it like this:
https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/84984139&single_active=false
Note the &single_active GET param added to the widget’s src

HTML symbol in flash variable

I got a Flash variable:
<param name=\"flashvars\" value=\"title=$title\" />
$title is a string, but in this string I want to put: ë or in HTML ë.
But flash doesn’t like it.
How to fix this?
thnx,
stefan
Did you try entitizing the &? For example, instead of
ë
your value would be
&euml;
Or it could be an encoding issue in your page. Or it could be that you are loading from a document whose BOM is absent.
Edited to say: I just remembered the flashvars parameter (which I no longer use) takes an ampersand-delimited list of arguments, just like a query string in a URL. So ampersands are going to be problematic no matter how they're used. It might be easier to set up your SWF to load those values from Javascript through ExternalInterface in Flash/Flex.
I don't believe there should be any issues with flashvars using special characters like ë. I just did a quick test, and it worked perfectly.
Just make sure the html document where you define the flashvars is saved as utf-8, and you should be good.
Also, if you are displaying the loaded text in a dynamic text field, make sure you have the right characters embedded - otherwise they won't display.