cordova-plugin-streaming-media, 用于加载全屏流视频或者音频的简单插件

分享于 

3分钟阅读

GitHub

  繁體 雙語
Simple plugin for loading full screen streaming video or audio.
  • 源代码名称:cordova-plugin-streaming-media
  • 源代码网址:http://www.github.com/nchutchind/cordova-plugin-streaming-media
  • cordova-plugin-streaming-media源代码文档
  • cordova-plugin-streaming-media源代码下载
  • Git URL:
    git://www.github.com/nchutchind/cordova-plugin-streaming-media.git
    Git Clone代码到本地:
    git clone http://www.github.com/nchutchind/cordova-plugin-streaming-media
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/nchutchind/cordova-plugin-streaming-media
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    Cordova流媒体插件

    对于iOS和 Android,由 Nicholas Hutchind

    描述

    这个插件允许你在iOS和安卓的本地播放器上播放音频和视频。

    • 1.0.0 与 Cordova 3合作。
    • 1.0.1+与 Cordova> = 4.0一起工作

    安装

    
    cordova plugin add cordova-plugin-streaming-media
    
    
    
    

    iOS详细信息

    • 使用 MPMoviePlayerController。
    • 已经在 iOS 7,9上测试

    Android

    • 使用VideoView和 MediaPlayer。
    • 在 AndroidManifest.xml 文件中创建两个 activity。
    • 在 Android 4.0 + 上测试

    用法

    var videoUrl =STREAMING_VIDEO_URL;
     // Just play a videowindow.plugins.streamingMedia.playVideo(videoUrl);
     // Play a video with callbacksvar options = {
     successCallback:function() {
     console.log("Video was closed without error.");
     },
     errorCallback:function(errMsg) {
     console.log("Error! "+ errMsg);
     },
     orientation:'landscape',
     shouldAutoClose:true, // true(default)/false controls:true// true(default)/false. Used to hide controls on fullscreen };
     window.plugins.streamingMedia.playVideo(videoUrl, options);
     var audioUrl =STREAMING_AUDIO_URL;
     // Play an audio file (not recommended, since the screen will be plain black)window.plugins.streamingMedia.playAudio(audioUrl);
     // Play an audio file with options (all options optional)var options = {
     bgColor:"#FFFFFF",
     bgImage:"<SWEET_BACKGROUND_IMAGE>",
     bgImageScale:"fit", // other valid values:"stretch" initFullscreen:false, // true(default)/false iOS onlysuccessCallback:function() {
     console.log("Player closed without error.");
     },
     errorCallback:function(errMsg) {
     console.log("Error! "+ errMsg);
     }
     };
     window.plugins.streamingMedia.playAudio(audioUrl, options);
     // Stop current audiowindow.plugins.streamingMedia.stopAudio();
     // Pause current audio (iOS only)window.plugins.streamingMedia.pauseAudio();
     // Resume current audio (iOS only)window.plugins.streamingMedia.resumeAudio(); 

    相关文章