Apache Cordova
  1. Apache Cordova
  2. CB-57

Feature request: update media to support streaming

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Plugin Media
    • Labels:
      None
    • Environment:

      iOS

      Description

      reported at: https://github.com/phonegap/phonegap-iphone/issues/55
      by: https://github.com/hardeep

      The AVAudioPlayer used to implement iOS media does not support streaming audio. In order to do that we need to use the Audio Toolbox. Example and more info here: http://cocoawithlove.com/2009/06/revisiting-old-post-streaming-and.html

      [Original LightHouse ticket](http://phonegap.lighthouseapp.com/projects/20116/tickets/105)

      This ticket has 0 attachment(s).

        Activity

        Hide
        Shazron Abdullah added a comment -

        by: http://github.com/becka11y

        another useful link: http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/introduction/introduction.html

        by: lux (on lighthouseapp.com)

        There’s a link on cocoawithlove.com in the comments with updates to support fixed length audio streaming, but it’s broken. Here’s a working link to that code: http://www.atwofer.com/2009/06/streaming-and-playing-fixed-length-mp3s.html

        by: http://github.com/shazron

        Note: Nitobi actually has code to support media streaming already that has been used on a project and tested (based on the cocoawithlove.com code)

        by: tiago (on lighthouseapp.com)

        is it freely available? can you please post the address? ty

        by: https://github.com/davechekan

        +1 for this feature in addition to adding support for getDuration, getCurrentPosition in iOS. This is my first time developing with phonegap, and posting a comment here- so I apologize for my ignorance in doing both properly.

        by: https://github.com/devgeeks

        I have a plugin I am finishing up that uses [Matt Gallagher's AudioStreamer code](https://github.com/mattgallagher/AudioStreamer) mentioned above.

        If anyone feels like helping to test it maybe we can get any bugs out and get it into the phonegap-plugins repo sooner...

        https://github.com/devgeeks/phonegap-plugins/tree/AudioStreamer/iPhone/AudioStream

        Show
        Shazron Abdullah added a comment - by: http://github.com/becka11y another useful link: http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/introduction/introduction.html by: lux (on lighthouseapp.com) There’s a link on cocoawithlove.com in the comments with updates to support fixed length audio streaming, but it’s broken. Here’s a working link to that code: http://www.atwofer.com/2009/06/streaming-and-playing-fixed-length-mp3s.html by: http://github.com/shazron Note: Nitobi actually has code to support media streaming already that has been used on a project and tested (based on the cocoawithlove.com code) by: tiago (on lighthouseapp.com) is it freely available? can you please post the address? ty by: https://github.com/davechekan +1 for this feature in addition to adding support for getDuration, getCurrentPosition in iOS. This is my first time developing with phonegap, and posting a comment here- so I apologize for my ignorance in doing both properly. by: https://github.com/devgeeks I have a plugin I am finishing up that uses [Matt Gallagher's AudioStreamer code] ( https://github.com/mattgallagher/AudioStreamer ) mentioned above. If anyone feels like helping to test it maybe we can get any bugs out and get it into the phonegap-plugins repo sooner... https://github.com/devgeeks/phonegap-plugins/tree/AudioStreamer/iPhone/AudioStream
        Hide
        Jean Vean added a comment -

        +1 for this feature. Pretty important in my humble opinion.

        Show
        Jean Vean added a comment - +1 for this feature. Pretty important in my humble opinion.
        Hide
        Shazron Abdullah added a comment -

        First step should be a 3rd party plugin. Then discussion can proceed to add to all platforms or just iOS, then possibly graduation to core.

        Show
        Shazron Abdullah added a comment - First step should be a 3rd party plugin. Then discussion can proceed to add to all platforms or just iOS, then possibly graduation to core.
        Hide
        Cirillo added a comment -
        Show
        Cirillo added a comment - There is already the 3rd party plugin https://github.com/keosuofficial/cordova-audio-stream-plugin
        Hide
        Gaven Henry added a comment -

        I have done a little work on modifying Media plugin to use avplayer for playing back URL's on iOS. This is implemented and working at the repo location below.

        I need to tidy it up a bit before submitting a pull request with the updates but so far so good, I am using it in my app and streams start playing almost instantly and all works as expected so far.

        I also want to implement some events for tracking current buffer amount and buffer status (empty / full) so that playback can be automatically resumed and the user can see buffer status but this would require platform specific changes to the media.js so I will hold off on those until after I have a clean PR in.

        All current Media functions work (seek, duration, getCurrentPosition, play, pause. Stop just calls pause at the moment as avplayer doesn't seem to have a "stop" method.

        In the mean time anyone that wants/needs it can just install from this branch on my fork:

        https://github.com/ghenry22/cordova-plugin-media/tree/background-threading

        Show
        Gaven Henry added a comment - I have done a little work on modifying Media plugin to use avplayer for playing back URL's on iOS. This is implemented and working at the repo location below. I need to tidy it up a bit before submitting a pull request with the updates but so far so good, I am using it in my app and streams start playing almost instantly and all works as expected so far. I also want to implement some events for tracking current buffer amount and buffer status (empty / full) so that playback can be automatically resumed and the user can see buffer status but this would require platform specific changes to the media.js so I will hold off on those until after I have a clean PR in. All current Media functions work (seek, duration, getCurrentPosition, play, pause. Stop just calls pause at the moment as avplayer doesn't seem to have a "stop" method. In the mean time anyone that wants/needs it can just install from this branch on my fork: https://github.com/ghenry22/cordova-plugin-media/tree/background-threading
        Hide
        ASF GitHub Bot added a comment -

        GitHub user ghenry22 opened a pull request:

        https://github.com/apache/cordova-plugin-media/pull/62

        Streaming & Background threading on play

        This fixes 2 issues in the Cordova Jira, both with iOS. It enables streaming support for media playback from URLs while retaining the existing playback for local media.

        The second part is the simply background thread the play function so it doesn't block the ui or lock up the app on load. Gets rid of some of those pesky warnings in xcode too.

        Tested with simulator and on iphone 5 and iphone 6 and ipad 2, with iOS 8.1, 8.3 & 8.4

        Please merge these and bump the version of the media plugin so I can stop installing them from my own fork

        Fix for CB-57
        Updated to use avplayer when url starts with http:// or https:// for
        full streaming support.

        All other urls will use the standard AVAudioplayer

        Fix for CB-8222
        Background thread on play to prevent locking during initial load of
        media.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/ghenry22/cordova-plugin-media avplayer_streaming

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/cordova-plugin-media/pull/62.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #62


        commit 00ddb9372bf4c9b96ccea0dbd285499df1809277
        Author: ghenry22 <ghenry22@gmail.com>
        Date: 2015-07-29T07:14:59Z

        Streaming & Background threading on play

        Fix for CB-57
        Updated to use avplayer when url starts with http:// or https:// for
        full streaming support.

        All other urls will use the standard AVAudioplayer

        Fix for CB-8222
        Background thread on play to prevent locking during initial load of
        media.


        Show
        ASF GitHub Bot added a comment - GitHub user ghenry22 opened a pull request: https://github.com/apache/cordova-plugin-media/pull/62 Streaming & Background threading on play This fixes 2 issues in the Cordova Jira, both with iOS. It enables streaming support for media playback from URLs while retaining the existing playback for local media. The second part is the simply background thread the play function so it doesn't block the ui or lock up the app on load. Gets rid of some of those pesky warnings in xcode too. Tested with simulator and on iphone 5 and iphone 6 and ipad 2, with iOS 8.1, 8.3 & 8.4 Please merge these and bump the version of the media plugin so I can stop installing them from my own fork Fix for CB-57 Updated to use avplayer when url starts with http:// or https:// for full streaming support. All other urls will use the standard AVAudioplayer Fix for CB-8222 Background thread on play to prevent locking during initial load of media. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ghenry22/cordova-plugin-media avplayer_streaming Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-media/pull/62.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #62 commit 00ddb9372bf4c9b96ccea0dbd285499df1809277 Author: ghenry22 <ghenry22@gmail.com> Date: 2015-07-29T07:14:59Z Streaming & Background threading on play Fix for CB-57 Updated to use avplayer when url starts with http:// or https:// for full streaming support. All other urls will use the standard AVAudioplayer Fix for CB-8222 Background thread on play to prevent locking during initial load of media.

          People

          • Assignee:
            Unassigned
            Reporter:
            Shazron Abdullah
          • Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development