apache / apache/cordova-ios

Media plugin not working after Cordova and Cordova iOS platform upgrades

Open
#1,101 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
1k
Avg merge
12h 11m
Merged PRs (30d)
18

Description

## Problem

Cordova app (jQuery + jQuery mobile) working fine using Cordova 8.1.2 and Cordova iOS 4.5.1. After upgrading Cordova to 10.0.0 and Cordova iOS platform to 6.2.0, I get the following error when creating a Media instance: **ReferenceError: Can't find variable Media**

### What is expected to happen?

```
var my_media = new Media(url);
my_media.play();
```
That should play audio file (mp3) found at url (external URL in my case). This works fine with Cordova Android 9.1.0.

### What does actually happen?

The line **var my_media = new Media(url);** gives error **ReferenceError: Can't find variable Media** when debugging via Xcode (in simulator with iOS version 14.4 and in device with iOS 12.x and 14.x).

## Information

Nothing has changed in the code of the app, only the platform upgrades mentioned above.

### Command or Code

`var my_media = new Media(url);`

### Environment, Platform, Device

iPhone 12 iOS 14.4
iPhone XS Max iOS 14.4
iPhone 5s 12.x

### Version information

Cordova 10.0.0
Cordova iOS 6.2.0
Xcode 12.4

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `new Media(url)` call with the listed Cordova and iOS versions, using Xcode on the stated simulator or devices. Trace why `Media` is unavailable after the platform upgrade, and consider the issue done when the external MP3 can be instantiated and played on iOS without the ReferenceError.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.