mediaelement.js是否与Phonegap兼容? [英] Is mediaelement.js compatible with Phonegap?
问题描述
我正在建立一个phonegap应用程序,我需要使用视频和音频流功能,我发现mediaelementjs似乎更适合跨平台的视频和音频功能。
我创建了一个演示和它的工作罚款在iOS& Android的浏览器,但是当我准备phonegap建立它不播放视频或音频在Android设备上。
mediaelement.js兼容phonegap吗?如果没有那么还有任何其他视频\audio播放器插件可以使用phonegap,而不是使用phonegap Media API。
感谢
Suresh
mediaelement.js是否与phonegap兼容?
是,它们兼容。 >
我已经看到他们在项目中一起使用。 PhoneGap 可能难以正确配置为与其他JS库b / c配合使用,以便 PhoneGap 绑定其自己的事件以管理环境。
不知道更多关于你的具体问题,我不能帮助你,以保证你,他们可以一起工作,有痛苦与配置和管理依赖。我建议您使用 Require.JS 这样的管理库来帮助管理依赖关系。
是否有任何其他视频\ audio player plugin可以使用phonegap,而不是使用phonegap Media API?
用于播放和录制音频文件的Media API
PG的优势是贡献者投入了大量精力使应用程序与本机驱动程序和工具配合使用。
播放音频文件的示例网址:
标记:
< a href =#class =btn largeonclick =playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');>播放音频< / a> ;
< a href =#class =btn largeonclick =pauseAudio();>暂停播放音频< / a>
< a href =#class =btn largeonclick =stopAudio();>停止播放音频< / a>
< p id =audio_position>< / p>
JavaScript :
//播放音频
//
function playAudio(url){
//播放音频文件url
var my_media = new Media(url,
// success callback
function(){
console.log(playAudio():Audio Success);
},
// error callback
function(err){
console.log(playAudio():Audio Error:+ err);
}
);
//播放音频
my_media.play();
}
包含的功能广泛且稳健,包括用于设置音量,
$ b 有许多Android Video-Player插件适用于PhoneGap:
此HTML 5视频播放器似乎支持所有平台:
I am building a phonegap application where i need to use video and audio streaming feature, i found that mediaelementjs seems more suitable for cross platform video and audio feature.
I created one demo and its working fine on iOS & Android browsers, but when i prepared phonegap build its not playing video or audio on android device.
Is mediaelement.js compatible with phonegap?if no then is there any other video\audio player plugin available which can use with phonegap, instead of using phonegap Media API.
Thanks Suresh
解决方案Is mediaelement.js compatible with phonegap?
Yes, they are compatible.
I have seen them used together on projects. PhoneGap can be difficult to configure properly to work with other JS libraries b/c of the extent to which PhoneGap binds its own events to manage the environment.
Without knowing more about your specific problem, I can't help you further than to assure you that they can work together and that there are pains with configuration and managing dependencies. I recommend using a mangement library like Require.JS to help manage the dependencies.
is there any other video\audio player plugin available which can use with phonegap, instead of using phonegap Media API?
Yes, infact PhoneGap has a Media API for playing and recording audio files
The advantage of PG is how much effort the contributors invested into making apps work with native drivers and tools. You will have an easier time (in general) relying on PG API's when possible.
documentation for PhoneGap media
Example playing an audio file from an URL:
Markup:
<a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');">Play Audio</a> <a href="#" class="btn large" onclick="pauseAudio();">Pause Playing Audio</a> <a href="#" class="btn large" onclick="stopAudio();">Stop Playing Audio</a> <p id="audio_position"></p>
JavaScript:
// Play audio // function playAudio(url) { // Play the audio file at url var my_media = new Media(url, // success callback function () { console.log("playAudio():Audio Success"); }, // error callback function (err) { console.log("playAudio():Audio Error: " + err); } ); // Play audio my_media.play(); }
The functionality included is extensive and robust, including tools for setting Volume, Play Position, Releasing media resources when finished.
There are many Android Video-Player plug-ins for PhoneGap:
VideoPlayer plugin for Phonegap
Adobe's Video Player for PhoneGap Android
This HTML 5 video-player seems to support all platforms:
HTML 5 Video player for Phone Gap
这篇关于mediaelement.js是否与Phonegap兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!